{"action":"created","comment":{"url":"https://api.github.com/repos/saltstack/salt/pulls/comments/26429419","id":26429419,"diff_hunk":"@@ -0,0 +1,284 @@\n+# -*- coding: utf-8 -*-\n+'''\n+Connection module for Amazon EC2\n+\n+.. versionadded:: TBD\n+\n+:configuration: This module accepts explicit EC2 credentials but can also\n+    utilize IAM roles assigned to the instance trough Instance Profiles.\n+    Dynamic credentials are then automatically obtained from AWS API and no\n+    further configuration is necessary. More Information available at::\n+\n+       http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html\n+\n+    If IAM roles are not used you need to specify them either in a pillar or\n+    in the minion's config file::\n+\n+        ec2.keyid: GKTADJGHEIQSXMKKRBJ08H\n+        ec2.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs\n+\n+    A region may also be specified in the configuration::\n+\n+        ec2.region: us-east-1\n+\n+    If a region is not specified, the default is us-east-1.\n+\n+    It's also possible to specify key, keyid and region via a profile, either\n+    as a passed in dict, or as a string to pull from pillars or minion config:\n+\n+        myprofile:\n+            keyid: GKTADJGHEIQSXMKKRBJ08H\n+            key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs\n+            region: us-east-1\n+\n+:depends: boto\n+\n+'''\n+\n+# Import Python libs\n+from __future__ import absolute_import\n+import logging\n+import time\n+from distutils.version import LooseVersion as _LooseVersion  # pylint: disable=import-error,no-name-in-module\n+\n+# Import Salt libs\n+from salt.exceptions import CommandExecutionError\n+\n+log = logging.getLogger(__name__)\n+\n+# Import third party libs\n+import salt.ext.six as six\n+# pylint: disable=import-error\n+try:\n+    # pylint: disable=import-error\n+    import boto\n+    import boto.ec2\n+    # pylint: enable=import-error\n+    logging.getLogger('boto').setLevel(logging.CRITICAL)\n+    HAS_BOTO = True\n+except ImportError:\n+    HAS_BOTO = False\n+# pylint: enable=import-error\n+\n+\n+def __virtual__():\n+    '''\n+    Only load if boto libraries exist and if boto libraries are greater than\n+    a given version.\n+    '''\n+    required_boto_version = '2.8.0'\n+    # the boto_ec2 execution module relies on the connect_to_region() method\n+    # which was added in boto 2.8.0\n+    # https://github.com/boto/boto/commit/33ac26b416fbb48a60602542b4ce15dcc7029f12\n+    if not HAS_BOTO:\n+        return False\n+    elif _LooseVersion(boto.__version__) < _LooseVersion(required_boto_version):\n+        return False\n+    else:\n+        return True\n+\n+\n+def find_instances(instance_id=None, name=None, tags=None, region=None,\n+                   key=None, keyid=None, profile=None, **kwargs):","path":"salt/modules/boto_ec2.py","position":82,"original_position":82,"commit_id":"1628f15ff843973bee3b76b3a13fb6300a81b43d","original_commit_id":"1628f15ff843973bee3b76b3a13fb6300a81b43d","user":{"login":"ryan-lane","id":1538354,"avatar_url":"https://avatars.githubusercontent.com/u/1538354?v=3","gravatar_id":"","url":"https://api.github.com/users/ryan-lane","html_url":"https://github.com/ryan-lane","followers_url":"https://api.github.com/users/ryan-lane/followers","following_url":"https://api.github.com/users/ryan-lane/following{/other_user}","gists_url":"https://api.github.com/users/ryan-lane/gists{/gist_id}","starred_url":"https://api.github.com/users/ryan-lane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryan-lane/subscriptions","organizations_url":"https://api.github.com/users/ryan-lane/orgs","repos_url":"https://api.github.com/users/ryan-lane/repos","events_url":"https://api.github.com/users/ryan-lane/events{/privacy}","received_events_url":"https://api.github.com/users/ryan-lane/received_events","type":"User","site_admin":false},"body":"**kwargs is going to bite you. Salt passes random crap into functions.","created_at":"2015-03-13T23:03:55Z","updated_at":"2015-03-13T23:03:55Z","html_url":"https://github.com/saltstack/salt/pull/21654#discussion_r26429419","pull_request_url":"https://api.github.com/repos/saltstack/salt/pulls/21654","_links":{"self":{"href":"https://api.github.com/repos/saltstack/salt/pulls/comments/26429419"},"html":{"href":"https://github.com/saltstack/salt/pull/21654#discussion_r26429419"},"pull_request":{"href":"https://api.github.com/repos/saltstack/salt/pulls/21654"}}},"pull_request":{"url":"https://api.github.com/repos/saltstack/salt/pulls/21654","id":31170847,"html_url":"https://github.com/saltstack/salt/pull/21654","diff_url":"https://github.com/saltstack/salt/pull/21654.diff","patch_url":"https://github.com/saltstack/salt/pull/21654.patch","issue_url":"https://api.github.com/repos/saltstack/salt/issues/21654","number":21654,"state":"open","locked":false,"title":"add rudimentary boto_ec2 module","user":{"login":"mgwilliams","id":478275,"avatar_url":"https://avatars.githubusercontent.com/u/478275?v=3","gravatar_id":"","url":"https://api.github.com/users/mgwilliams","html_url":"https://github.com/mgwilliams","followers_url":"https://api.github.com/users/mgwilliams/followers","following_url":"https://api.github.com/users/mgwilliams/following{/other_user}","gists_url":"https://api.github.com/users/mgwilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/mgwilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgwilliams/subscriptions","organizations_url":"https://api.github.com/users/mgwilliams/orgs","repos_url":"https://api.github.com/users/mgwilliams/repos","events_url":"https://api.github.com/users/mgwilliams/events{/privacy}","received_events_url":"https://api.github.com/users/mgwilliams/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-13T22:55:07Z","updated_at":"2015-03-13T23:03:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"52602a007ad8c34649ef7e284c45fd60b4f678c8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/saltstack/salt/pulls/21654/commits","review_comments_url":"https://api.github.com/repos/saltstack/salt/pulls/21654/comments","review_comment_url":"https://api.github.com/repos/saltstack/salt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/21654/comments","statuses_url":"https://api.github.com/repos/saltstack/salt/statuses/1628f15ff843973bee3b76b3a13fb6300a81b43d","head":{"label":"mgwilliams:boto_ec2","ref":"boto_ec2","sha":"1628f15ff843973bee3b76b3a13fb6300a81b43d","user":{"login":"mgwilliams","id":478275,"avatar_url":"https://avatars.githubusercontent.com/u/478275?v=3","gravatar_id":"","url":"https://api.github.com/users/mgwilliams","html_url":"https://github.com/mgwilliams","followers_url":"https://api.github.com/users/mgwilliams/followers","following_url":"https://api.github.com/users/mgwilliams/following{/other_user}","gists_url":"https://api.github.com/users/mgwilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/mgwilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgwilliams/subscriptions","organizations_url":"https://api.github.com/users/mgwilliams/orgs","repos_url":"https://api.github.com/users/mgwilliams/repos","events_url":"https://api.github.com/users/mgwilliams/events{/privacy}","received_events_url":"https://api.github.com/users/mgwilliams/received_events","type":"User","site_admin":false},"repo":{"id":8511256,"name":"salt","full_name":"mgwilliams/salt","owner":{"login":"mgwilliams","id":478275,"avatar_url":"https://avatars.githubusercontent.com/u/478275?v=3","gravatar_id":"","url":"https://api.github.com/users/mgwilliams","html_url":"https://github.com/mgwilliams","followers_url":"https://api.github.com/users/mgwilliams/followers","following_url":"https://api.github.com/users/mgwilliams/following{/other_user}","gists_url":"https://api.github.com/users/mgwilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/mgwilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgwilliams/subscriptions","organizations_url":"https://api.github.com/users/mgwilliams/orgs","repos_url":"https://api.github.com/users/mgwilliams/repos","events_url":"https://api.github.com/users/mgwilliams/events{/privacy}","received_events_url":"https://api.github.com/users/mgwilliams/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mgwilliams/salt","description":"Central system and configuration manager ","fork":true,"url":"https://api.github.com/repos/mgwilliams/salt","forks_url":"https://api.github.com/repos/mgwilliams/salt/forks","keys_url":"https://api.github.com/repos/mgwilliams/salt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mgwilliams/salt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mgwilliams/salt/teams","hooks_url":"https://api.github.com/repos/mgwilliams/salt/hooks","issue_events_url":"https://api.github.com/repos/mgwilliams/salt/issues/events{/number}","events_url":"https://api.github.com/repos/mgwilliams/salt/events","assignees_url":"https://api.github.com/repos/mgwilliams/salt/assignees{/user}","branches_url":"https://api.github.com/repos/mgwilliams/salt/branches{/branch}","tags_url":"https://api.github.com/repos/mgwilliams/salt/tags","blobs_url":"https://api.github.com/repos/mgwilliams/salt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mgwilliams/salt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mgwilliams/salt/git/refs{/sha}","trees_url":"https://api.github.com/repos/mgwilliams/salt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mgwilliams/salt/statuses/{sha}","languages_url":"https://api.github.com/repos/mgwilliams/salt/languages","stargazers_url":"https://api.github.com/repos/mgwilliams/salt/stargazers","contributors_url":"https://api.github.com/repos/mgwilliams/salt/contributors","subscribers_url":"https://api.github.com/repos/mgwilliams/salt/subscribers","subscription_url":"https://api.github.com/repos/mgwilliams/salt/subscription","commits_url":"https://api.github.com/repos/mgwilliams/salt/commits{/sha}","git_commits_url":"https://api.github.com/repos/mgwilliams/salt/git/commits{/sha}","comments_url":"https://api.github.com/repos/mgwilliams/salt/comments{/number}","issue_comment_url":"https://api.github.com/repos/mgwilliams/salt/issues/comments{/number}","contents_url":"https://api.github.com/repos/mgwilliams/salt/contents/{+path}","compare_url":"https://api.github.com/repos/mgwilliams/salt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mgwilliams/salt/merges","archive_url":"https://api.github.com/repos/mgwilliams/salt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mgwilliams/salt/downloads","issues_url":"https://api.github.com/repos/mgwilliams/salt/issues{/number}","pulls_url":"https://api.github.com/repos/mgwilliams/salt/pulls{/number}","milestones_url":"https://api.github.com/repos/mgwilliams/salt/milestones{/number}","notifications_url":"https://api.github.com/repos/mgwilliams/salt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mgwilliams/salt/labels{/name}","releases_url":"https://api.github.com/repos/mgwilliams/salt/releases{/id}","created_at":"2013-03-01T22:08:00Z","updated_at":"2014-09-22T19:25:51Z","pushed_at":"2015-03-13T22:54:00Z","git_url":"git://github.com/mgwilliams/salt.git","ssh_url":"git@github.com:mgwilliams/salt.git","clone_url":"https://github.com/mgwilliams/salt.git","svn_url":"https://github.com/mgwilliams/salt","homepage":"saltstack.org","size":81781,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"saltstack:develop","ref":"develop","sha":"d8f1cffd1073a3f4a12fc559d6937a2b8ea6c512","user":{"login":"saltstack","id":1147473,"avatar_url":"https://avatars.githubusercontent.com/u/1147473?v=3","gravatar_id":"","url":"https://api.github.com/users/saltstack","html_url":"https://github.com/saltstack","followers_url":"https://api.github.com/users/saltstack/followers","following_url":"https://api.github.com/users/saltstack/following{/other_user}","gists_url":"https://api.github.com/users/saltstack/gists{/gist_id}","starred_url":"https://api.github.com/users/saltstack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saltstack/subscriptions","organizations_url":"https://api.github.com/users/saltstack/orgs","repos_url":"https://api.github.com/users/saltstack/repos","events_url":"https://api.github.com/users/saltstack/events{/privacy}","received_events_url":"https://api.github.com/users/saltstack/received_events","type":"Organization","site_admin":false},"repo":{"id":1390248,"name":"salt","full_name":"saltstack/salt","owner":{"login":"saltstack","id":1147473,"avatar_url":"https://avatars.githubusercontent.com/u/1147473?v=3","gravatar_id":"","url":"https://api.github.com/users/saltstack","html_url":"https://github.com/saltstack","followers_url":"https://api.github.com/users/saltstack/followers","following_url":"https://api.github.com/users/saltstack/following{/other_user}","gists_url":"https://api.github.com/users/saltstack/gists{/gist_id}","starred_url":"https://api.github.com/users/saltstack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saltstack/subscriptions","organizations_url":"https://api.github.com/users/saltstack/orgs","repos_url":"https://api.github.com/users/saltstack/repos","events_url":"https://api.github.com/users/saltstack/events{/privacy}","received_events_url":"https://api.github.com/users/saltstack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/saltstack/salt","description":"Infrastructure automation and management system","fork":false,"url":"https://api.github.com/repos/saltstack/salt","forks_url":"https://api.github.com/repos/saltstack/salt/forks","keys_url":"https://api.github.com/repos/saltstack/salt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/saltstack/salt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/saltstack/salt/teams","hooks_url":"https://api.github.com/repos/saltstack/salt/hooks","issue_events_url":"https://api.github.com/repos/saltstack/salt/issues/events{/number}","events_url":"https://api.github.com/repos/saltstack/salt/events","assignees_url":"https://api.github.com/repos/saltstack/salt/assignees{/user}","branches_url":"https://api.github.com/repos/saltstack/salt/branches{/branch}","tags_url":"https://api.github.com/repos/saltstack/salt/tags","blobs_url":"https://api.github.com/repos/saltstack/salt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/saltstack/salt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/saltstack/salt/git/refs{/sha}","trees_url":"https://api.github.com/repos/saltstack/salt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/saltstack/salt/statuses/{sha}","languages_url":"https://api.github.com/repos/saltstack/salt/languages","stargazers_url":"https://api.github.com/repos/saltstack/salt/stargazers","contributors_url":"https://api.github.com/repos/saltstack/salt/contributors","subscribers_url":"https://api.github.com/repos/saltstack/salt/subscribers","subscription_url":"https://api.github.com/repos/saltstack/salt/subscription","commits_url":"https://api.github.com/repos/saltstack/salt/commits{/sha}","git_commits_url":"https://api.github.com/repos/saltstack/salt/git/commits{/sha}","comments_url":"https://api.github.com/repos/saltstack/salt/comments{/number}","issue_comment_url":"https://api.github.com/repos/saltstack/salt/issues/comments{/number}","contents_url":"https://api.github.com/repos/saltstack/salt/contents/{+path}","compare_url":"https://api.github.com/repos/saltstack/salt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/saltstack/salt/merges","archive_url":"https://api.github.com/repos/saltstack/salt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/saltstack/salt/downloads","issues_url":"https://api.github.com/repos/saltstack/salt/issues{/number}","pulls_url":"https://api.github.com/repos/saltstack/salt/pulls{/number}","milestones_url":"https://api.github.com/repos/saltstack/salt/milestones{/number}","notifications_url":"https://api.github.com/repos/saltstack/salt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/saltstack/salt/labels{/name}","releases_url":"https://api.github.com/repos/saltstack/salt/releases{/id}","created_at":"2011-02-20T20:16:56Z","updated_at":"2015-03-13T22:57:15Z","pushed_at":"2015-03-13T22:41:11Z","git_url":"git://github.com/saltstack/salt.git","ssh_url":"git@github.com:saltstack/salt.git","clone_url":"https://github.com/saltstack/salt.git","svn_url":"https://github.com/saltstack/salt","homepage":"saltstack.com","size":194186,"stargazers_count":4822,"watchers_count":4822,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2007,"mirror_url":null,"open_issues_count":2371,"forks":2007,"open_issues":2371,"watchers":4822,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/saltstack/salt/pulls/21654"},"html":{"href":"https://github.com/saltstack/salt/pull/21654"},"issue":{"href":"https://api.github.com/repos/saltstack/salt/issues/21654"},"comments":{"href":"https://api.github.com/repos/saltstack/salt/issues/21654/comments"},"review_comments":{"href":"https://api.github.com/repos/saltstack/salt/pulls/21654/comments"},"review_comment":{"href":"https://api.github.com/repos/saltstack/salt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/saltstack/salt/pulls/21654/commits"},"statuses":{"href":"https://api.github.com/repos/saltstack/salt/statuses/1628f15ff843973bee3b76b3a13fb6300a81b43d"}}}}