{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/76110272","id":76110272,"diff_hunk":"@@ -0,0 +1,255 @@\n+require 'net/scp'\n+\n+module MiqAeMethodService\n+  class MiqAeServiceContainerDeployment < MiqAeServiceModelBase\n+    expose :container_deployment_nodes, :association => true\n+    expose :deployed_ems, :association => true\n+    expose :deployed_on_ems, :association => true\n+    expose :automation_task, :association => true\n+    expose :roles_addresses\n+    expose :container_nodes_by_role\n+    expose :ssh_auth\n+    expose :rhsm_auth\n+    expose :generate_ansible_yaml\n+    expose :generate_ansible_inventory_for_subscription\n+    expose :add_deployment_provider\n+    SUBSCRIPTION_REPOS = [\"rhel-7-server-rh-common-rpms\", \"rhel-7-server-rpms\", \"rhel-7-server-extras-rpms\", \"rhel-7-server-ose-3.2-rpms\"].freeze\n+    ANSIBLE_LOG = \"/tmp/ansible.log\".freeze\n+    ANSIBLE_ERROR_LOG = \"/tmp/openshift-ansible.log\".freeze\n+    INVENTORIES_PATH = \"/usr/share/ansible/openshift-ansible/\".freeze\n+    SSH_AGENT_PATH = \"/tmp/ssh_manageiq/\".freeze\n+\n+    def subscribe_deployment_master(deployment_master, user)\n+      rhsub_user = rhsm_auth.userid\n+      rhsub_pass = rhsm_auth.password\n+      rhsm_sku = rhsm_auth.rhsm_sku\n+      perform_agent_commands(deployment_master, user, [\"sudo subscription-manager register --username='#{rhsub_user}' --password='#{rhsub_pass}'\"])\n+      pool_cmdret = perform_agent_commands(deployment_master, user, [\"sudo subscription-manager list --available --matches='#{rhsm_sku}' --pool-only\"])\n+      pool_id = pool_cmdret[:stdout].split(\"\\n\").first.to_s.strip\n+      perform_agent_commands(deployment_master, user, [\"sudo subscription-manager attach --pool='#{pool_id}'\"]) unless pool_id.blank?\n+      enabled_repos_cmdret = perform_agent_commands(deployment_master, user, ['sudo subscription-manager repos --disable=\"*\"',\n+                                                                              \"sudo subscription-manager repos --enable=#{SUBSCRIPTION_REPOS.join(\" --enable=\")}\",\n+                                                                              \"sudo subscription-manager repos --list-enabled\"])\n+      enabled_repos = enabled_repos_cmdret[:stdout].split(\" \").to_a.map(&:strip).reject(&:empty?)\n+      missing_repos = SUBSCRIPTION_REPOS - enabled_repos\n+      raise StandardError, \"couldn't register to following repos : #{missing_repos.join(',')} with SKU : #{rhsm_sku}\" unless missing_repos.empty?\n+    end\n+\n+    def subscribe_cluster(deployment_master, user)\n+      perform_agent_commands(deployment_master, user, [\"sudo mv ~/rhel_subscribe_inventory.yaml #{INVENTORIES_PATH}\"])","path":"lib/miq_automation_engine/service_models/miq_ae_service_container_deployment.rb","position":39,"original_position":39,"commit_id":"aa847689901298082372b8b00f6e08d89b37eec4","original_commit_id":"aa847689901298082372b8b00f6e08d89b37eec4","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":"Make `rhel_subscribe_inventory.yaml` a constant since it is referenced twice here.","created_at":"2016-08-24T18:17:04Z","updated_at":"2016-08-24T18:17:04Z","html_url":"https://github.com/ManageIQ/manageiq/pull/9230#discussion_r76110272","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9230","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/76110272"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/9230#discussion_r76110272"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9230"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9230","id":73941928,"html_url":"https://github.com/ManageIQ/manageiq/pull/9230","diff_url":"https://github.com/ManageIQ/manageiq/pull/9230.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/9230.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/9230","number":9230,"state":"open","locked":false,"title":"Service models required for container deployment automation","user":{"login":"alongoldboim","id":11405684,"avatar_url":"https://avatars.githubusercontent.com/u/11405684?v=3","gravatar_id":"","url":"https://api.github.com/users/alongoldboim","html_url":"https://github.com/alongoldboim","followers_url":"https://api.github.com/users/alongoldboim/followers","following_url":"https://api.github.com/users/alongoldboim/following{/other_user}","gists_url":"https://api.github.com/users/alongoldboim/gists{/gist_id}","starred_url":"https://api.github.com/users/alongoldboim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alongoldboim/subscriptions","organizations_url":"https://api.github.com/users/alongoldboim/orgs","repos_url":"https://api.github.com/users/alongoldboim/repos","events_url":"https://api.github.com/users/alongoldboim/events{/privacy}","received_events_url":"https://api.github.com/users/alongoldboim/received_events","type":"User","site_admin":false},"body":"BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1356623","created_at":"2016-06-15T16:20:18Z","updated_at":"2016-08-24T18:17:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c7f9172d416a38a9e07d4782481d15df6bf6c49b","assignee":{"login":"simon3z","id":130393,"avatar_url":"https://avatars.githubusercontent.com/u/130393?v=3","gravatar_id":"","url":"https://api.github.com/users/simon3z","html_url":"https://github.com/simon3z","followers_url":"https://api.github.com/users/simon3z/followers","following_url":"https://api.github.com/users/simon3z/following{/other_user}","gists_url":"https://api.github.com/users/simon3z/gists{/gist_id}","starred_url":"https://api.github.com/users/simon3z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simon3z/subscriptions","organizations_url":"https://api.github.com/users/simon3z/orgs","repos_url":"https://api.github.com/users/simon3z/repos","events_url":"https://api.github.com/users/simon3z/events{/privacy}","received_events_url":"https://api.github.com/users/simon3z/received_events","type":"User","site_admin":false},"assignees":[{"login":"simon3z","id":130393,"avatar_url":"https://avatars.githubusercontent.com/u/130393?v=3","gravatar_id":"","url":"https://api.github.com/users/simon3z","html_url":"https://github.com/simon3z","followers_url":"https://api.github.com/users/simon3z/followers","following_url":"https://api.github.com/users/simon3z/following{/other_user}","gists_url":"https://api.github.com/users/simon3z/gists{/gist_id}","starred_url":"https://api.github.com/users/simon3z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simon3z/subscriptions","organizations_url":"https://api.github.com/users/simon3z/orgs","repos_url":"https://api.github.com/users/simon3z/repos","events_url":"https://api.github.com/users/simon3z/events{/privacy}","received_events_url":"https://api.github.com/users/simon3z/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9230/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9230/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/9230/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/aa847689901298082372b8b00f6e08d89b37eec4","head":{"label":"alongoldboim:container_deployment_automation_service_models","ref":"container_deployment_automation_service_models","sha":"aa847689901298082372b8b00f6e08d89b37eec4","user":{"login":"alongoldboim","id":11405684,"avatar_url":"https://avatars.githubusercontent.com/u/11405684?v=3","gravatar_id":"","url":"https://api.github.com/users/alongoldboim","html_url":"https://github.com/alongoldboim","followers_url":"https://api.github.com/users/alongoldboim/followers","following_url":"https://api.github.com/users/alongoldboim/following{/other_user}","gists_url":"https://api.github.com/users/alongoldboim/gists{/gist_id}","starred_url":"https://api.github.com/users/alongoldboim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alongoldboim/subscriptions","organizations_url":"https://api.github.com/users/alongoldboim/orgs","repos_url":"https://api.github.com/users/alongoldboim/repos","events_url":"https://api.github.com/users/alongoldboim/events{/privacy}","received_events_url":"https://api.github.com/users/alongoldboim/received_events","type":"User","site_admin":false},"repo":{"id":48227094,"name":"manageiq","full_name":"alongoldboim/manageiq","owner":{"login":"alongoldboim","id":11405684,"avatar_url":"https://avatars.githubusercontent.com/u/11405684?v=3","gravatar_id":"","url":"https://api.github.com/users/alongoldboim","html_url":"https://github.com/alongoldboim","followers_url":"https://api.github.com/users/alongoldboim/followers","following_url":"https://api.github.com/users/alongoldboim/following{/other_user}","gists_url":"https://api.github.com/users/alongoldboim/gists{/gist_id}","starred_url":"https://api.github.com/users/alongoldboim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alongoldboim/subscriptions","organizations_url":"https://api.github.com/users/alongoldboim/orgs","repos_url":"https://api.github.com/users/alongoldboim/repos","events_url":"https://api.github.com/users/alongoldboim/events{/privacy}","received_events_url":"https://api.github.com/users/alongoldboim/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alongoldboim/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/alongoldboim/manageiq","forks_url":"https://api.github.com/repos/alongoldboim/manageiq/forks","keys_url":"https://api.github.com/repos/alongoldboim/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alongoldboim/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alongoldboim/manageiq/teams","hooks_url":"https://api.github.com/repos/alongoldboim/manageiq/hooks","issue_events_url":"https://api.github.com/repos/alongoldboim/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/alongoldboim/manageiq/events","assignees_url":"https://api.github.com/repos/alongoldboim/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/alongoldboim/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/alongoldboim/manageiq/tags","blobs_url":"https://api.github.com/repos/alongoldboim/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alongoldboim/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alongoldboim/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/alongoldboim/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alongoldboim/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/alongoldboim/manageiq/languages","stargazers_url":"https://api.github.com/repos/alongoldboim/manageiq/stargazers","contributors_url":"https://api.github.com/repos/alongoldboim/manageiq/contributors","subscribers_url":"https://api.github.com/repos/alongoldboim/manageiq/subscribers","subscription_url":"https://api.github.com/repos/alongoldboim/manageiq/subscription","commits_url":"https://api.github.com/repos/alongoldboim/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/alongoldboim/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/alongoldboim/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/alongoldboim/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/alongoldboim/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/alongoldboim/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alongoldboim/manageiq/merges","archive_url":"https://api.github.com/repos/alongoldboim/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alongoldboim/manageiq/downloads","issues_url":"https://api.github.com/repos/alongoldboim/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/alongoldboim/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/alongoldboim/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/alongoldboim/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alongoldboim/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/alongoldboim/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/alongoldboim/manageiq/deployments","created_at":"2015-12-18T09:42:32Z","updated_at":"2015-12-18T09:42:48Z","pushed_at":"2016-08-24T13:04:17Z","git_url":"git://github.com/alongoldboim/manageiq.git","ssh_url":"git@github.com:alongoldboim/manageiq.git","clone_url":"https://github.com/alongoldboim/manageiq.git","svn_url":"https://github.com/alongoldboim/manageiq","homepage":"manageiq.org","size":153514,"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":"69c3310799bc30fc3e5174d143498226c89db2ca","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 Open-Source 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}","deployments_url":"https://api.github.com/repos/ManageIQ/manageiq/deployments","created_at":"2014-06-13T02:31:26Z","updated_at":"2016-08-23T15:59:58Z","pushed_at":"2016-08-24T18:07:00Z","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":196308,"stargazers_count":307,"watchers_count":307,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":343,"mirror_url":null,"open_issues_count":783,"forks":343,"open_issues":783,"watchers":307,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9230"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/9230"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/9230"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/9230/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9230/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9230/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/aa847689901298082372b8b00f6e08d89b37eec4"}}}}
{"actor":{"display_login":"gmcculloug"}}