{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/33827394","id":33827394,"diff_hunk":"@@ -40,25 +40,39 @@ def total_cloud_networks\n     cloud_networks.size\n   end\n \n-  # @param options [Hash] what to update for the stack. Option keys and values are:\n-  #   :template (String, URI, S3::S3Object, Object) - A new stack template.\n-  #     This may be provided in a number of formats including:\n-  #       a String, containing the template in CFN or HOT format.\n-  #       a URL String pointing to the document in S3.\n-  #       a URI object pointing to the document in S3.\n-  #       an S3::S3Object which contains the template.\n-  #       an Object which responds to #to_json and returns the template.\n-  #   :parameters (Hash) - A hash that specifies the input parameters of the new stack.\n+  def self.create_stack(orchestration_manager, stack_name, template, options = {})\n+    klass = \"OrchestrationStack#{orchestration_manager.class.name.match(/Ems(.*)/)[1]}\".constantize\n+    ems_ref = klass.raw_create_stack(orchestration_manager, stack_name, template, options)\n+\n+    klass.create(:name                   => stack_name,\n+                 :ems_ref                => ems_ref,\n+                 :status                 => 'CREATE_IN_PROGRESS',\n+                 :ext_management_system  => orchestration_manager,\n+                 :orchestration_template => template)\n+  end\n+\n+  def self.raw_create_stack(_orchestration_manager, _stack_name, _template, _options = {})\n+    raise NotImplementedError, \"raw_create_stack must be implemented in a subclass\"\n+  end","path":"vmdb/app/models/orchestration_stack.rb","position":26,"original_position":26,"commit_id":"3482680cadcff41228707293ae69951465e9727f","original_commit_id":"3482680cadcff41228707293ae69951465e9727f","user":{"login":"matthewd","id":1034,"avatar_url":"https://avatars.githubusercontent.com/u/1034?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewd","html_url":"https://github.com/matthewd","followers_url":"https://api.github.com/users/matthewd/followers","following_url":"https://api.github.com/users/matthewd/following{/other_user}","gists_url":"https://api.github.com/users/matthewd/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewd/subscriptions","organizations_url":"https://api.github.com/users/matthewd/orgs","repos_url":"https://api.github.com/users/matthewd/repos","events_url":"https://api.github.com/users/matthewd/events{/privacy}","received_events_url":"https://api.github.com/users/matthewd/received_events","type":"User","site_admin":false},"body":"@Fryguy I'm definitely wondering the same thing... but that seems like a problem for Future Us (suckers!).\r\n\r\nIf we need to introduce duplication while splitting the providers, we'll do that trivially. Re-unifying code that's been deliberately duplicated is much more painful / less likely to happen just because it can.\r\n\r\nI think the consistency is going to be pretty.. consistent, as long as they're all trying to put the data in a same-looking DB.","created_at":"2015-07-02T22:03:58Z","updated_at":"2015-07-02T22:03:58Z","html_url":"https://github.com/ManageIQ/manageiq/pull/2573#discussion_r33827394","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2573","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/33827394"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/2573#discussion_r33827394"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2573"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2573","id":32969132,"html_url":"https://github.com/ManageIQ/manageiq/pull/2573","diff_url":"https://github.com/ManageIQ/manageiq/pull/2573.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/2573.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/2573","number":2573,"state":"open","locked":false,"title":"Refactor: move orchestration stack operations from provider to stack classes","user":{"login":"bzwei","id":7047579,"avatar_url":"https://avatars.githubusercontent.com/u/7047579?v=3","gravatar_id":"","url":"https://api.github.com/users/bzwei","html_url":"https://github.com/bzwei","followers_url":"https://api.github.com/users/bzwei/followers","following_url":"https://api.github.com/users/bzwei/following{/other_user}","gists_url":"https://api.github.com/users/bzwei/gists{/gist_id}","starred_url":"https://api.github.com/users/bzwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bzwei/subscriptions","organizations_url":"https://api.github.com/users/bzwei/orgs","repos_url":"https://api.github.com/users/bzwei/repos","events_url":"https://api.github.com/users/bzwei/events{/privacy}","received_events_url":"https://api.github.com/users/bzwei/received_events","type":"User","site_admin":false},"body":"Provider classes already have methods to create and query status of orchestration stacks. It makes sense to move implementations of updating and deleting stacks to provider. `OrchestrationStack` contains only delegate methods for the operations. Each subclass of `OrchestrationStack` no longer needs to implement these methods.\r\n\r\nThis PR also expose some of the operations in the miq ae service model\r\n\r\n[UPDATE]\r\nAfter the initial review comments, we decided to do the opposite. Now I have moved all stack operation (create, delete, update, and query status) from provider to `OrchestrationStack` and subclasses.","created_at":"2015-04-09T15:53:17Z","updated_at":"2015-07-02T22:03:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"389b5a7ea3c7ce04e327f3ecdf96f6d18895ce28","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2573/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2573/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/2573/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/3482680cadcff41228707293ae69951465e9727f","head":{"label":"bzwei:refactor_ems_stack_operation","ref":"refactor_ems_stack_operation","sha":"3482680cadcff41228707293ae69951465e9727f","user":{"login":"bzwei","id":7047579,"avatar_url":"https://avatars.githubusercontent.com/u/7047579?v=3","gravatar_id":"","url":"https://api.github.com/users/bzwei","html_url":"https://github.com/bzwei","followers_url":"https://api.github.com/users/bzwei/followers","following_url":"https://api.github.com/users/bzwei/following{/other_user}","gists_url":"https://api.github.com/users/bzwei/gists{/gist_id}","starred_url":"https://api.github.com/users/bzwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bzwei/subscriptions","organizations_url":"https://api.github.com/users/bzwei/orgs","repos_url":"https://api.github.com/users/bzwei/repos","events_url":"https://api.github.com/users/bzwei/events{/privacy}","received_events_url":"https://api.github.com/users/bzwei/received_events","type":"User","site_admin":false},"repo":{"id":20813025,"name":"manageiq","full_name":"bzwei/manageiq","owner":{"login":"bzwei","id":7047579,"avatar_url":"https://avatars.githubusercontent.com/u/7047579?v=3","gravatar_id":"","url":"https://api.github.com/users/bzwei","html_url":"https://github.com/bzwei","followers_url":"https://api.github.com/users/bzwei/followers","following_url":"https://api.github.com/users/bzwei/following{/other_user}","gists_url":"https://api.github.com/users/bzwei/gists{/gist_id}","starred_url":"https://api.github.com/users/bzwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bzwei/subscriptions","organizations_url":"https://api.github.com/users/bzwei/orgs","repos_url":"https://api.github.com/users/bzwei/repos","events_url":"https://api.github.com/users/bzwei/events{/privacy}","received_events_url":"https://api.github.com/users/bzwei/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bzwei/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/bzwei/manageiq","forks_url":"https://api.github.com/repos/bzwei/manageiq/forks","keys_url":"https://api.github.com/repos/bzwei/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bzwei/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bzwei/manageiq/teams","hooks_url":"https://api.github.com/repos/bzwei/manageiq/hooks","issue_events_url":"https://api.github.com/repos/bzwei/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/bzwei/manageiq/events","assignees_url":"https://api.github.com/repos/bzwei/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/bzwei/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/bzwei/manageiq/tags","blobs_url":"https://api.github.com/repos/bzwei/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bzwei/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bzwei/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/bzwei/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bzwei/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/bzwei/manageiq/languages","stargazers_url":"https://api.github.com/repos/bzwei/manageiq/stargazers","contributors_url":"https://api.github.com/repos/bzwei/manageiq/contributors","subscribers_url":"https://api.github.com/repos/bzwei/manageiq/subscribers","subscription_url":"https://api.github.com/repos/bzwei/manageiq/subscription","commits_url":"https://api.github.com/repos/bzwei/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/bzwei/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/bzwei/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/bzwei/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/bzwei/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/bzwei/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bzwei/manageiq/merges","archive_url":"https://api.github.com/repos/bzwei/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bzwei/manageiq/downloads","issues_url":"https://api.github.com/repos/bzwei/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/bzwei/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/bzwei/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/bzwei/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bzwei/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/bzwei/manageiq/releases{/id}","created_at":"2014-06-13T18:02:48Z","updated_at":"2014-06-24T18:52:43Z","pushed_at":"2015-06-30T17:58:21Z","git_url":"git://github.com/bzwei/manageiq.git","ssh_url":"git@github.com:bzwei/manageiq.git","clone_url":"https://github.com/bzwei/manageiq.git","svn_url":"https://github.com/bzwei/manageiq","homepage":null,"size":75876,"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":"cdcf40e6f5000d36bdbd1253b76a87194d8baebc","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-07-01T10:40:15Z","pushed_at":"2015-07-02T22:01:31Z","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":131625,"stargazers_count":122,"watchers_count":122,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":124,"mirror_url":null,"open_issues_count":358,"forks":124,"open_issues":358,"watchers":122,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2573"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/2573"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/2573"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/2573/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2573/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2573/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/3482680cadcff41228707293ae69951465e9727f"}}}}