{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/30137125","id":30137125,"diff_hunk":"@@ -1,32 +1,18 @@\n class MiqProvisionRequestTemplate < MiqProvisionRequest\n-\n   def create_tasks_for_service(service_task, parent_svc)\n-\n     template_service_resource = ServiceResource.find_by_id(service_task.options[:service_resource_id])\n-    scaling_min = template_service_resource.nil? ? 1 : template_service_resource.scaling_min\n-\n-    tasks = []\n-    0.upto(scaling_min - 1).each do |idx|\n-\n-      task = self.create_request_task(idx)\n-      task.options[:miq_force_unique_name] = [true, 1]\n-      task.options[:service_guid] = parent_svc.guid\n-      task.options[:service_resource_id] = template_service_resource.id\n-      task.options[:service_template_request] = false\n-      task.userid = service_task.userid\n-      user = User.find_by_userid(task.userid)\n-      unless user.nil?\n-        task.options[:owner_email]      = user.email\n-        task.options[:owner_first_name] = user.first_name\n-        task.options[:owner_last_name]  = user.last_name\n-      end\n-      task.save!\n-      service_task.miq_request.miq_request_tasks << task\n+    scaling_min = template_service_resource.try(:scaling_min) || 1","path":"vmdb/app/models/miq_provision_request_template.rb","position":25,"original_position":25,"commit_id":"dbc8a9112f044e23a0b5b648fa5cb2f6739e6bdf","original_commit_id":"dbc8a9112f044e23a0b5b648fa5cb2f6739e6bdf","user":{"login":"jrafanie","id":19339,"avatar_url":"https://avatars.githubusercontent.com/u/19339?v=3","gravatar_id":"","url":"https://api.github.com/users/jrafanie","html_url":"https://github.com/jrafanie","followers_url":"https://api.github.com/users/jrafanie/followers","following_url":"https://api.github.com/users/jrafanie/following{/other_user}","gists_url":"https://api.github.com/users/jrafanie/gists{/gist_id}","starred_url":"https://api.github.com/users/jrafanie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrafanie/subscriptions","organizations_url":"https://api.github.com/users/jrafanie/orgs","repos_url":"https://api.github.com/users/jrafanie/repos","events_url":"https://api.github.com/users/jrafanie/events{/privacy}","received_events_url":"https://api.github.com/users/jrafanie/received_events","type":"User","site_admin":false},"body":"Ok, right... makes sense!","created_at":"2015-05-12T14:11:28Z","updated_at":"2015-05-12T14:11:28Z","html_url":"https://github.com/ManageIQ/manageiq/pull/2878#discussion_r30137125","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2878","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/30137125"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/2878#discussion_r30137125"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2878"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2878","id":34957935,"html_url":"https://github.com/ManageIQ/manageiq/pull/2878","diff_url":"https://github.com/ManageIQ/manageiq/pull/2878.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/2878.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/2878","number":2878,"state":"open","locked":false,"title":"Fixed unique names for provisioned VMs when ordered through a service","user":{"login":"gmcculloug","id":2591569,"avatar_url":"https://avatars.githubusercontent.com/u/2591569?v=3","gravatar_id":"","url":"https://api.github.com/users/gmcculloug","html_url":"https://github.com/gmcculloug","followers_url":"https://api.github.com/users/gmcculloug/followers","following_url":"https://api.github.com/users/gmcculloug/following{/other_user}","gists_url":"https://api.github.com/users/gmcculloug/gists{/gist_id}","starred_url":"https://api.github.com/users/gmcculloug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmcculloug/subscriptions","organizations_url":"https://api.github.com/users/gmcculloug/orgs","repos_url":"https://api.github.com/users/gmcculloug/repos","events_url":"https://api.github.com/users/gmcculloug/events{/privacy}","received_events_url":"https://api.github.com/users/gmcculloug/received_events","type":"User","site_admin":false},"body":"Service ordering is a repeatable task that requires the creation of unique names for provisioned VMs that are part of the service template.  To ensure that a unique name is applied to the provisioned VMs a flag is set on the provision task to instruct the naming code to append an enumeration sequence to the VM name if one is not already supplied.  PR #2023 fixed an issue with the naming code being run twice for a service provision but exposed the current bug because the naming code was running before the unique_name flag was set.\r\n\r\nThis change allows the caller to provide a block and update the new task object before the naming code is run.\r\n\r\nhttps://bugzilla.redhat.com/show_bug.cgi?id=1219098","created_at":"2015-05-07T21:01:36Z","updated_at":"2015-05-12T14:11:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ab6411450d4e75c4dc1044bbea37df4281164804","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2878/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2878/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/2878/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/dbc8a9112f044e23a0b5b648fa5cb2f6739e6bdf","head":{"label":"gmcculloug:service_provision_unique_name","ref":"service_provision_unique_name","sha":"dbc8a9112f044e23a0b5b648fa5cb2f6739e6bdf","user":{"login":"gmcculloug","id":2591569,"avatar_url":"https://avatars.githubusercontent.com/u/2591569?v=3","gravatar_id":"","url":"https://api.github.com/users/gmcculloug","html_url":"https://github.com/gmcculloug","followers_url":"https://api.github.com/users/gmcculloug/followers","following_url":"https://api.github.com/users/gmcculloug/following{/other_user}","gists_url":"https://api.github.com/users/gmcculloug/gists{/gist_id}","starred_url":"https://api.github.com/users/gmcculloug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmcculloug/subscriptions","organizations_url":"https://api.github.com/users/gmcculloug/orgs","repos_url":"https://api.github.com/users/gmcculloug/repos","events_url":"https://api.github.com/users/gmcculloug/events{/privacy}","received_events_url":"https://api.github.com/users/gmcculloug/received_events","type":"User","site_admin":false},"repo":{"id":20885993,"name":"manageiq","full_name":"gmcculloug/manageiq","owner":{"login":"gmcculloug","id":2591569,"avatar_url":"https://avatars.githubusercontent.com/u/2591569?v=3","gravatar_id":"","url":"https://api.github.com/users/gmcculloug","html_url":"https://github.com/gmcculloug","followers_url":"https://api.github.com/users/gmcculloug/followers","following_url":"https://api.github.com/users/gmcculloug/following{/other_user}","gists_url":"https://api.github.com/users/gmcculloug/gists{/gist_id}","starred_url":"https://api.github.com/users/gmcculloug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmcculloug/subscriptions","organizations_url":"https://api.github.com/users/gmcculloug/orgs","repos_url":"https://api.github.com/users/gmcculloug/repos","events_url":"https://api.github.com/users/gmcculloug/events{/privacy}","received_events_url":"https://api.github.com/users/gmcculloug/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gmcculloug/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/gmcculloug/manageiq","forks_url":"https://api.github.com/repos/gmcculloug/manageiq/forks","keys_url":"https://api.github.com/repos/gmcculloug/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gmcculloug/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gmcculloug/manageiq/teams","hooks_url":"https://api.github.com/repos/gmcculloug/manageiq/hooks","issue_events_url":"https://api.github.com/repos/gmcculloug/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/gmcculloug/manageiq/events","assignees_url":"https://api.github.com/repos/gmcculloug/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/gmcculloug/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/gmcculloug/manageiq/tags","blobs_url":"https://api.github.com/repos/gmcculloug/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gmcculloug/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gmcculloug/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/gmcculloug/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gmcculloug/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/gmcculloug/manageiq/languages","stargazers_url":"https://api.github.com/repos/gmcculloug/manageiq/stargazers","contributors_url":"https://api.github.com/repos/gmcculloug/manageiq/contributors","subscribers_url":"https://api.github.com/repos/gmcculloug/manageiq/subscribers","subscription_url":"https://api.github.com/repos/gmcculloug/manageiq/subscription","commits_url":"https://api.github.com/repos/gmcculloug/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/gmcculloug/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/gmcculloug/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/gmcculloug/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/gmcculloug/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/gmcculloug/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gmcculloug/manageiq/merges","archive_url":"https://api.github.com/repos/gmcculloug/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gmcculloug/manageiq/downloads","issues_url":"https://api.github.com/repos/gmcculloug/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/gmcculloug/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/gmcculloug/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/gmcculloug/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gmcculloug/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/gmcculloug/manageiq/releases{/id}","created_at":"2014-06-16T13:34:52Z","updated_at":"2015-05-08T13:02:58Z","pushed_at":"2015-05-11T21:33:46Z","git_url":"git://github.com/gmcculloug/manageiq.git","ssh_url":"git@github.com:gmcculloug/manageiq.git","clone_url":"https://github.com/gmcculloug/manageiq.git","svn_url":"https://github.com/gmcculloug/manageiq","homepage":null,"size":72588,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ManageIQ:master","ref":"master","sha":"09bf4fe2b3229f406db5cb87571f2e539123286e","user":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":20789757,"name":"manageiq","full_name":"ManageIQ/manageiq","owner":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManageIQ/manageiq","description":"ManageIQ Cloud Management Platform","fork":false,"url":"https://api.github.com/repos/ManageIQ/manageiq","forks_url":"https://api.github.com/repos/ManageIQ/manageiq/forks","keys_url":"https://api.github.com/repos/ManageIQ/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/manageiq/teams","hooks_url":"https://api.github.com/repos/ManageIQ/manageiq/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/manageiq/events","assignees_url":"https://api.github.com/repos/ManageIQ/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/manageiq/tags","blobs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/manageiq/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/manageiq/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/manageiq/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/manageiq/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/manageiq/subscription","commits_url":"https://api.github.com/repos/ManageIQ/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/manageiq/merges","archive_url":"https://api.github.com/repos/ManageIQ/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/manageiq/downloads","issues_url":"https://api.github.com/repos/ManageIQ/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/manageiq/releases{/id}","created_at":"2014-06-13T02:31:26Z","updated_at":"2015-05-08T20:51:03Z","pushed_at":"2015-05-12T14:04:52Z","git_url":"git://github.com/ManageIQ/manageiq.git","ssh_url":"git@github.com:ManageIQ/manageiq.git","clone_url":"https://github.com/ManageIQ/manageiq.git","svn_url":"https://github.com/ManageIQ/manageiq","homepage":"manageiq.org","size":130519,"stargazers_count":111,"watchers_count":111,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":110,"mirror_url":null,"open_issues_count":358,"forks":110,"open_issues":358,"watchers":111,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2878"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/2878"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/2878"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/2878/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2878/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2878/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/dbc8a9112f044e23a0b5b648fa5cb2f6739e6bdf"}}}}