{"action":"created","comment":{"url":"https://api.github.com/repos/ansible/ansible/pulls/comments/223934788","pull_request_review_id":163182049,"id":223934788,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzkzNDc4OA==","diff_hunk":"@@ -0,0 +1,162 @@\n+#!/usr/bin/env python\n+# -*- coding: utf-8 -*-\n+\n+import os\n+import sys\n+\n+import pytest\n+\n+# contrib's dirstruct doesn't contain __init__.py files\n+# import ec2 inventory manually\n+root_dir = os.path.dirname(\n+    os.path.dirname(\n+        os.path.dirname(\n+            os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))\n+inventory_dir = os.path.join(root_dir, 'contrib', 'inventory')\n+inventory_dir_abspath = os.path.abspath(inventory_dir)\n+sys.path.append(inventory_dir_abspath)","path":"test/units/contrib/inventory/test_ec2_inventory.py","position":17,"original_position":17,"commit_id":"34569ca184d74cd6e4eca0fc904d6da198abf6bb","original_commit_id":"34569ca184d74cd6e4eca0fc904d6da198abf6bb","user":{"login":"mattclay","id":806360,"node_id":"MDQ6VXNlcjgwNjM2MA==","avatar_url":"https://avatars0.githubusercontent.com/u/806360?v=4","gravatar_id":"","url":"https://api.github.com/users/mattclay","html_url":"https://github.com/mattclay","followers_url":"https://api.github.com/users/mattclay/followers","following_url":"https://api.github.com/users/mattclay/following{/other_user}","gists_url":"https://api.github.com/users/mattclay/gists{/gist_id}","starred_url":"https://api.github.com/users/mattclay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattclay/subscriptions","organizations_url":"https://api.github.com/users/mattclay/orgs","repos_url":"https://api.github.com/users/mattclay/repos","events_url":"https://api.github.com/users/mattclay/events{/privacy}","received_events_url":"https://api.github.com/users/mattclay/received_events","type":"User","site_admin":false},"body":"It's not safe to modify sys.path outside of unit test functions, as these changes will effect other unrelated tests.","created_at":"2018-10-10T04:41:56Z","updated_at":"2018-10-10T04:41:57Z","html_url":"https://github.com/ansible/ansible/pull/46666#discussion_r223934788","pull_request_url":"https://api.github.com/repos/ansible/ansible/pulls/46666","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible/pulls/comments/223934788"},"html":{"href":"https://github.com/ansible/ansible/pull/46666#discussion_r223934788"},"pull_request":{"href":"https://api.github.com/repos/ansible/ansible/pulls/46666"}}},"pull_request":{"url":"https://api.github.com/repos/ansible/ansible/pulls/46666","id":221308626,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIxMzA4NjI2","html_url":"https://github.com/ansible/ansible/pull/46666","diff_url":"https://github.com/ansible/ansible/pull/46666.diff","patch_url":"https://github.com/ansible/ansible/pull/46666.patch","issue_url":"https://api.github.com/repos/ansible/ansible/issues/46666","number":46666,"state":"open","locked":false,"title":"feat(ec2.py): enhance regions input","user":{"login":"hanks","id":759107,"node_id":"MDQ6VXNlcjc1OTEwNw==","avatar_url":"https://avatars2.githubusercontent.com/u/759107?v=4","gravatar_id":"","url":"https://api.github.com/users/hanks","html_url":"https://github.com/hanks","followers_url":"https://api.github.com/users/hanks/followers","following_url":"https://api.github.com/users/hanks/following{/other_user}","gists_url":"https://api.github.com/users/hanks/gists{/gist_id}","starred_url":"https://api.github.com/users/hanks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanks/subscriptions","organizations_url":"https://api.github.com/users/hanks/orgs","repos_url":"https://api.github.com/users/hanks/repos","events_url":"https://api.github.com/users/hanks/events{/privacy}","received_events_url":"https://api.github.com/users/hanks/received_events","type":"User","site_admin":false},"body":"##### SUMMARY\r\n<!--- Describe the change below, including rationale and design decisions -->\r\nEnhance regions input like below:\r\n\r\n1. add --regions option\r\n   currently there is no option for regions, so add this for handy\r\n2. support space and comma for region input\r\n   because in ec2.ini, input for `regions_exclude` uses `comma and space`, but `regions` can not, it is a little confused, Add this to make them consistent\r\n3. fix logic to always exclude regions specified\r\n   seems `regions_exclude` does not be used for all the conditions, so add logic to exclude every time\r\n4. fix logic to call eucalyptus, there is no usage like `self.regions.append(boto.connect_euca(host=self.eucalyptus_host).region.name, **self.credentials)`, shoule be `self.regions.append(boto.connect_euca(host=self.eucalyptus_host, **self.credentials).region.name)`\r\n5. add unittest for regions part in ec2.py\r\n6. add docs for options usage\r\n7. refactor a little for unit test easily\r\n\r\n##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest -->\r\n- Feature Pull Request\r\n\r\n##### COMPONENT NAME\r\n<!--- Write the short name of the module, plugin, task or feature below -->\r\ncontrib/inventory/ec2.py\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from \"ansible --version\" between quotes -->\r\n```paste below\r\nansible 2.7.0\r\n  config file = None\r\n  configured module search path = ['/Users/hanzhou/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /usr/local/var/pyenv/versions/3.6.4/envs/3.6.4/lib/python3.6/site-packages/ansible\r\n  executable location = /usr/local/var/pyenv/versions/3.6.4/bin/ansible\r\n  python version = 3.6.4 (default, Mar 23 2018, 19:03:30) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]\r\n```\r\n","created_at":"2018-10-09T04:57:50Z","updated_at":"2018-10-10T04:41:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ef5294ea72fb29f18d9779666175c63d3c7c789a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1043397454,"node_id":"MDU6TGFiZWwxMDQzMzk3NDU0","url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.8","name":"affects_2.8","color":"ededed","default":false},{"id":379680333,"node_id":"MDU6TGFiZWwzNzk2ODAzMzM=","url":"https://api.github.com/repos/ansible/ansible/labels/aws","name":"aws","color":"c5def5","default":false},{"id":511880827,"node_id":"MDU6TGFiZWw1MTE4ODA4Mjc=","url":"https://api.github.com/repos/ansible/ansible/labels/c:inventory/contrib_script","name":"c:inventory/contrib_script","color":"b60205","default":false},{"id":61528803,"node_id":"MDU6TGFiZWw2MTUyODgwMw==","url":"https://api.github.com/repos/ansible/ansible/labels/cloud","name":"cloud","color":"c7def8","default":false},{"id":852590921,"node_id":"MDU6TGFiZWw4NTI1OTA5MjE=","url":"https://api.github.com/repos/ansible/ansible/labels/feature","name":"feature","color":"006b75","default":false},{"id":612318497,"node_id":"MDU6TGFiZWw2MTIzMTg0OTc=","url":"https://api.github.com/repos/ansible/ansible/labels/inventory","name":"inventory","color":"1d76db","default":false},{"id":723150340,"node_id":"MDU6TGFiZWw3MjMxNTAzNDA=","url":"https://api.github.com/repos/ansible/ansible/labels/new_contributor","name":"new_contributor","color":"c2e0c6","default":false},{"id":383076471,"node_id":"MDU6TGFiZWwzODMwNzY0NzE=","url":"https://api.github.com/repos/ansible/ansible/labels/python3","name":"python3","color":"fbca04","default":false},{"id":636327968,"node_id":"MDU6TGFiZWw2MzYzMjc5Njg=","url":"https://api.github.com/repos/ansible/ansible/labels/support:community","name":"support:community","color":"ededed","default":false},{"id":636352796,"node_id":"MDU6TGFiZWw2MzYzNTI3OTY=","url":"https://api.github.com/repos/ansible/ansible/labels/support:core","name":"support:core","color":"ededed","default":false},{"id":468273802,"node_id":"MDU6TGFiZWw0NjgyNzM4MDI=","url":"https://api.github.com/repos/ansible/ansible/labels/test","name":"test","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ansible/ansible/pulls/46666/commits","review_comments_url":"https://api.github.com/repos/ansible/ansible/pulls/46666/comments","review_comment_url":"https://api.github.com/repos/ansible/ansible/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/46666/comments","statuses_url":"https://api.github.com/repos/ansible/ansible/statuses/34569ca184d74cd6e4eca0fc904d6da198abf6bb","head":{"label":"hanks:feat/add-regions-args-to-ec2-py","ref":"feat/add-regions-args-to-ec2-py","sha":"34569ca184d74cd6e4eca0fc904d6da198abf6bb","user":{"login":"hanks","id":759107,"node_id":"MDQ6VXNlcjc1OTEwNw==","avatar_url":"https://avatars2.githubusercontent.com/u/759107?v=4","gravatar_id":"","url":"https://api.github.com/users/hanks","html_url":"https://github.com/hanks","followers_url":"https://api.github.com/users/hanks/followers","following_url":"https://api.github.com/users/hanks/following{/other_user}","gists_url":"https://api.github.com/users/hanks/gists{/gist_id}","starred_url":"https://api.github.com/users/hanks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanks/subscriptions","organizations_url":"https://api.github.com/users/hanks/orgs","repos_url":"https://api.github.com/users/hanks/repos","events_url":"https://api.github.com/users/hanks/events{/privacy}","received_events_url":"https://api.github.com/users/hanks/received_events","type":"User","site_admin":false},"repo":{"id":152173500,"node_id":"MDEwOlJlcG9zaXRvcnkxNTIxNzM1MDA=","name":"ansible","full_name":"hanks/ansible","private":false,"owner":{"login":"hanks","id":759107,"node_id":"MDQ6VXNlcjc1OTEwNw==","avatar_url":"https://avatars2.githubusercontent.com/u/759107?v=4","gravatar_id":"","url":"https://api.github.com/users/hanks","html_url":"https://github.com/hanks","followers_url":"https://api.github.com/users/hanks/followers","following_url":"https://api.github.com/users/hanks/following{/other_user}","gists_url":"https://api.github.com/users/hanks/gists{/gist_id}","starred_url":"https://api.github.com/users/hanks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanks/subscriptions","organizations_url":"https://api.github.com/users/hanks/orgs","repos_url":"https://api.github.com/users/hanks/repos","events_url":"https://api.github.com/users/hanks/events{/privacy}","received_events_url":"https://api.github.com/users/hanks/received_events","type":"User","site_admin":false},"html_url":"https://github.com/hanks/ansible","description":"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications — automate in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com/ansible/","fork":true,"url":"https://api.github.com/repos/hanks/ansible","forks_url":"https://api.github.com/repos/hanks/ansible/forks","keys_url":"https://api.github.com/repos/hanks/ansible/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hanks/ansible/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hanks/ansible/teams","hooks_url":"https://api.github.com/repos/hanks/ansible/hooks","issue_events_url":"https://api.github.com/repos/hanks/ansible/issues/events{/number}","events_url":"https://api.github.com/repos/hanks/ansible/events","assignees_url":"https://api.github.com/repos/hanks/ansible/assignees{/user}","branches_url":"https://api.github.com/repos/hanks/ansible/branches{/branch}","tags_url":"https://api.github.com/repos/hanks/ansible/tags","blobs_url":"https://api.github.com/repos/hanks/ansible/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hanks/ansible/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hanks/ansible/git/refs{/sha}","trees_url":"https://api.github.com/repos/hanks/ansible/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hanks/ansible/statuses/{sha}","languages_url":"https://api.github.com/repos/hanks/ansible/languages","stargazers_url":"https://api.github.com/repos/hanks/ansible/stargazers","contributors_url":"https://api.github.com/repos/hanks/ansible/contributors","subscribers_url":"https://api.github.com/repos/hanks/ansible/subscribers","subscription_url":"https://api.github.com/repos/hanks/ansible/subscription","commits_url":"https://api.github.com/repos/hanks/ansible/commits{/sha}","git_commits_url":"https://api.github.com/repos/hanks/ansible/git/commits{/sha}","comments_url":"https://api.github.com/repos/hanks/ansible/comments{/number}","issue_comment_url":"https://api.github.com/repos/hanks/ansible/issues/comments{/number}","contents_url":"https://api.github.com/repos/hanks/ansible/contents/{+path}","compare_url":"https://api.github.com/repos/hanks/ansible/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hanks/ansible/merges","archive_url":"https://api.github.com/repos/hanks/ansible/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hanks/ansible/downloads","issues_url":"https://api.github.com/repos/hanks/ansible/issues{/number}","pulls_url":"https://api.github.com/repos/hanks/ansible/pulls{/number}","milestones_url":"https://api.github.com/repos/hanks/ansible/milestones{/number}","notifications_url":"https://api.github.com/repos/hanks/ansible/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hanks/ansible/labels{/name}","releases_url":"https://api.github.com/repos/hanks/ansible/releases{/id}","deployments_url":"https://api.github.com/repos/hanks/ansible/deployments","created_at":"2018-10-09T02:11:11Z","updated_at":"2018-10-09T02:11:42Z","pushed_at":"2018-10-10T04:09:04Z","git_url":"git://github.com/hanks/ansible.git","ssh_url":"git@github.com:hanks/ansible.git","clone_url":"https://github.com/hanks/ansible.git","svn_url":"https://github.com/hanks/ansible","homepage":"https://www.ansible.com/","size":134722,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"devel"}},"base":{"label":"ansible:devel","ref":"devel","sha":"5e67981dd2d8c909841088e00bb2fd95be2324d0","user":{"login":"ansible","id":1507452,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MDc0NTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1507452?v=4","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"repo":{"id":3638964,"node_id":"MDEwOlJlcG9zaXRvcnkzNjM4OTY0","name":"ansible","full_name":"ansible/ansible","private":false,"owner":{"login":"ansible","id":1507452,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MDc0NTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1507452?v=4","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ansible/ansible","description":"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications — automate in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com/ansible/","fork":false,"url":"https://api.github.com/repos/ansible/ansible","forks_url":"https://api.github.com/repos/ansible/ansible/forks","keys_url":"https://api.github.com/repos/ansible/ansible/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ansible/ansible/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ansible/ansible/teams","hooks_url":"https://api.github.com/repos/ansible/ansible/hooks","issue_events_url":"https://api.github.com/repos/ansible/ansible/issues/events{/number}","events_url":"https://api.github.com/repos/ansible/ansible/events","assignees_url":"https://api.github.com/repos/ansible/ansible/assignees{/user}","branches_url":"https://api.github.com/repos/ansible/ansible/branches{/branch}","tags_url":"https://api.github.com/repos/ansible/ansible/tags","blobs_url":"https://api.github.com/repos/ansible/ansible/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ansible/ansible/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ansible/ansible/git/refs{/sha}","trees_url":"https://api.github.com/repos/ansible/ansible/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ansible/ansible/statuses/{sha}","languages_url":"https://api.github.com/repos/ansible/ansible/languages","stargazers_url":"https://api.github.com/repos/ansible/ansible/stargazers","contributors_url":"https://api.github.com/repos/ansible/ansible/contributors","subscribers_url":"https://api.github.com/repos/ansible/ansible/subscribers","subscription_url":"https://api.github.com/repos/ansible/ansible/subscription","commits_url":"https://api.github.com/repos/ansible/ansible/commits{/sha}","git_commits_url":"https://api.github.com/repos/ansible/ansible/git/commits{/sha}","comments_url":"https://api.github.com/repos/ansible/ansible/comments{/number}","issue_comment_url":"https://api.github.com/repos/ansible/ansible/issues/comments{/number}","contents_url":"https://api.github.com/repos/ansible/ansible/contents/{+path}","compare_url":"https://api.github.com/repos/ansible/ansible/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ansible/ansible/merges","archive_url":"https://api.github.com/repos/ansible/ansible/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ansible/ansible/downloads","issues_url":"https://api.github.com/repos/ansible/ansible/issues{/number}","pulls_url":"https://api.github.com/repos/ansible/ansible/pulls{/number}","milestones_url":"https://api.github.com/repos/ansible/ansible/milestones{/number}","notifications_url":"https://api.github.com/repos/ansible/ansible/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ansible/ansible/labels{/name}","releases_url":"https://api.github.com/repos/ansible/ansible/releases{/id}","deployments_url":"https://api.github.com/repos/ansible/ansible/deployments","created_at":"2012-03-06T14:58:02Z","updated_at":"2018-10-10T04:37:06Z","pushed_at":"2018-10-10T04:30:31Z","git_url":"git://github.com/ansible/ansible.git","ssh_url":"git@github.com:ansible/ansible.git","clone_url":"https://github.com/ansible/ansible.git","svn_url":"https://github.com/ansible/ansible","homepage":"https://www.ansible.com/","size":142794,"stargazers_count":33034,"watchers_count":33034,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":13053,"mirror_url":null,"archived":false,"open_issues_count":5496,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":13053,"open_issues":5496,"watchers":33034,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible/pulls/46666"},"html":{"href":"https://github.com/ansible/ansible/pull/46666"},"issue":{"href":"https://api.github.com/repos/ansible/ansible/issues/46666"},"comments":{"href":"https://api.github.com/repos/ansible/ansible/issues/46666/comments"},"review_comments":{"href":"https://api.github.com/repos/ansible/ansible/pulls/46666/comments"},"review_comment":{"href":"https://api.github.com/repos/ansible/ansible/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ansible/ansible/pulls/46666/commits"},"statuses":{"href":"https://api.github.com/repos/ansible/ansible/statuses/34569ca184d74cd6e4eca0fc904d6da198abf6bb"}},"author_association":"NONE"}}
{"actor":{"display_login":"mattclay"}}