{"action":"created","comment":{"url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/comments/40699787","id":40699787,"diff_hunk":"@@ -0,0 +1,114 @@\n+# Copyright 2009-2015 Eucalyptus Systems, Inc.\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation; version 3 of the License.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program.  If not, see http://www.gnu.org/licenses/.\n+#\n+# Please contact Eucalyptus Systems, Inc., 6755 Hollister Ave., Goleta\n+# CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need\n+# additional information or have any questions.\n+\n+#\n+# Order matters here. We want to make sure we initialize logging before anything\n+# else happens. We need to initialize the logger that boto will be using.\n+#\n+\n+import sys\n+import subprocess\n+import os\n+from urlparse import urlparse\n+\n+\n+class EsiBase(object):\n+\n+    def __init__(self, region='localhost'):\n+        self.vars = {}\n+        self.region = region\n+        self._load_vars()\n+        self.check_environment()\n+\n+    def list_system_accounts(self):\n+        accounts = {}\n+        process = subprocess.Popen(['/usr/bin/euare-accountlist',\n+                                    '-U', self.vars[\"AWS_IAM_URL\"],\n+                                    '-I', self.vars[\"AWS_ACCESS_KEY_ID\"],\n+                                    '-S', self.vars[\"AWS_SECRET_ACCESS_KEY\"]],\n+                                   stdout=subprocess.PIPE)\n+        t = process.communicate()\n+        if process.returncode == 0:\n+            for account in t[0].split('\\n'):\n+                a = account.split('\\t')\n+                if len(a) == 2:\n+                    accounts[a[0]] = a[1]\n+        return accounts\n+\n+    def _load_vars(self):\n+        EsiBase._check_binary(['euca-generate-environment-config'])\n+        process = subprocess.Popen(['euca-generate-environment-config', '--simple', '--region',\n+                                    self.region], stdout=subprocess.PIPE)\n+        t = process.communicate()\n+        if process.returncode == 0:\n+            for var in t[0].split('\\n'):\n+                v = var.split(\"=\")\n+                if len(v) == 2:\n+                    self.vars[v[0]] = v[1] if v[1] != '' else None\n+\n+    @staticmethod\n+    def _check_binary(binary):\n+        try:\n+            with open(os.devnull, 'w') as nullfile:\n+                subprocess.call(binary, env=os.environ.copy(), stdout=nullfile)\n+        except OSError:\n+            print >> sys.stderr, \"Error: cannot execute '{0}' binary.\".format(\" \".join(binary))\n+            print >> sys.stderr, \"Make sure EUCALYPTUS path variable is exported.\"\n+            sys.exit(1)\n+\n+    def _get_properties_url(self):\n+        url = urlparse(self.vars[\"EC2_URL\"])\n+        port = url.port if url.port else 80\n+        return \"{0}://{1}:{2}{3}\".format(url.scheme, url.hostname, port, '/services/Properties')","path":"esitoolsupport/esibase.py","position":77,"original_position":77,"commit_id":"4cb22b7c4ef426c343caff7cba209b62dc05c1ee","original_commit_id":"4cb22b7c4ef426c343caff7cba209b62dc05c1ee","user":{"login":"vasiliykochergin","id":2006867,"avatar_url":"https://avatars.githubusercontent.com/u/2006867?v=3","gravatar_id":"","url":"https://api.github.com/users/vasiliykochergin","html_url":"https://github.com/vasiliykochergin","followers_url":"https://api.github.com/users/vasiliykochergin/followers","following_url":"https://api.github.com/users/vasiliykochergin/following{/other_user}","gists_url":"https://api.github.com/users/vasiliykochergin/gists{/gist_id}","starred_url":"https://api.github.com/users/vasiliykochergin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vasiliykochergin/subscriptions","organizations_url":"https://api.github.com/users/vasiliykochergin/orgs","repos_url":"https://api.github.com/users/vasiliykochergin/repos","events_url":"https://api.github.com/users/vasiliykochergin/events{/privacy}","received_events_url":"https://api.github.com/users/vasiliykochergin/received_events","type":"User","site_admin":false},"body":"@gholms Well, the tool does not generate it.  How euctrl tool generates the path if it is not known? Could euca-generate-environment-config use the same logic?","created_at":"2015-09-29T17:17:12Z","updated_at":"2015-09-29T17:17:12Z","html_url":"https://github.com/eucalyptus/eucalyptus-service-image/pull/13#discussion_r40699787","pull_request_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/comments/40699787"},"html":{"href":"https://github.com/eucalyptus/eucalyptus-service-image/pull/13#discussion_r40699787"},"pull_request":{"href":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/13","id":46222116,"html_url":"https://github.com/eucalyptus/eucalyptus-service-image/pull/13","diff_url":"https://github.com/eucalyptus/eucalyptus-service-image/pull/13.diff","patch_url":"https://github.com/eucalyptus/eucalyptus-service-image/pull/13.patch","issue_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/issues/13","number":13,"state":"open","locked":false,"title":"Use euca-generate-environment-config to get environment variables.","user":{"login":"vasiliykochergin","id":2006867,"avatar_url":"https://avatars.githubusercontent.com/u/2006867?v=3","gravatar_id":"","url":"https://api.github.com/users/vasiliykochergin","html_url":"https://github.com/vasiliykochergin","followers_url":"https://api.github.com/users/vasiliykochergin/followers","following_url":"https://api.github.com/users/vasiliykochergin/following{/other_user}","gists_url":"https://api.github.com/users/vasiliykochergin/gists{/gist_id}","starred_url":"https://api.github.com/users/vasiliykochergin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vasiliykochergin/subscriptions","organizations_url":"https://api.github.com/users/vasiliykochergin/orgs","repos_url":"https://api.github.com/users/vasiliykochergin/repos","events_url":"https://api.github.com/users/vasiliykochergin/events{/privacy}","received_events_url":"https://api.github.com/users/vasiliykochergin/received_events","type":"User","site_admin":false},"body":"FIxes for: EUCA-10801","created_at":"2015-09-28T23:49:03Z","updated_at":"2015-09-29T17:17:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0354cb5be39a6190a852cc6f1b794bbe4b2c5a77","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/13/commits","review_comments_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/13/comments","review_comment_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/issues/13/comments","statuses_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/statuses/4cb22b7c4ef426c343caff7cba209b62dc05c1ee","head":{"label":"eucalyptus:EUCA-10801","ref":"EUCA-10801","sha":"4cb22b7c4ef426c343caff7cba209b62dc05c1ee","user":{"login":"eucalyptus","id":808244,"avatar_url":"https://avatars.githubusercontent.com/u/808244?v=3","gravatar_id":"","url":"https://api.github.com/users/eucalyptus","html_url":"https://github.com/eucalyptus","followers_url":"https://api.github.com/users/eucalyptus/followers","following_url":"https://api.github.com/users/eucalyptus/following{/other_user}","gists_url":"https://api.github.com/users/eucalyptus/gists{/gist_id}","starred_url":"https://api.github.com/users/eucalyptus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eucalyptus/subscriptions","organizations_url":"https://api.github.com/users/eucalyptus/orgs","repos_url":"https://api.github.com/users/eucalyptus/repos","events_url":"https://api.github.com/users/eucalyptus/events{/privacy}","received_events_url":"https://api.github.com/users/eucalyptus/received_events","type":"Organization","site_admin":false},"repo":{"id":27593561,"name":"eucalyptus-service-image","full_name":"eucalyptus/eucalyptus-service-image","owner":{"login":"eucalyptus","id":808244,"avatar_url":"https://avatars.githubusercontent.com/u/808244?v=3","gravatar_id":"","url":"https://api.github.com/users/eucalyptus","html_url":"https://github.com/eucalyptus","followers_url":"https://api.github.com/users/eucalyptus/followers","following_url":"https://api.github.com/users/eucalyptus/following{/other_user}","gists_url":"https://api.github.com/users/eucalyptus/gists{/gist_id}","starred_url":"https://api.github.com/users/eucalyptus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eucalyptus/subscriptions","organizations_url":"https://api.github.com/users/eucalyptus/orgs","repos_url":"https://api.github.com/users/eucalyptus/repos","events_url":"https://api.github.com/users/eucalyptus/events{/privacy}","received_events_url":"https://api.github.com/users/eucalyptus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eucalyptus/eucalyptus-service-image","description":"Code for building an RPM containing VM image with multiple Eucalyptus services","fork":false,"url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image","forks_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/forks","keys_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/teams","hooks_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/hooks","issue_events_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/issues/events{/number}","events_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/events","assignees_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/assignees{/user}","branches_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/branches{/branch}","tags_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/tags","blobs_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/statuses/{sha}","languages_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/languages","stargazers_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/stargazers","contributors_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/contributors","subscribers_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/subscribers","subscription_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/subscription","commits_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/contents/{+path}","compare_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/merges","archive_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/downloads","issues_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/issues{/number}","pulls_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls{/number}","milestones_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/milestones{/number}","notifications_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/labels{/name}","releases_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/releases{/id}","created_at":"2014-12-05T13:52:09Z","updated_at":"2015-05-01T00:31:40Z","pushed_at":"2015-09-28T23:49:03Z","git_url":"git://github.com/eucalyptus/eucalyptus-service-image.git","ssh_url":"git@github.com:eucalyptus/eucalyptus-service-image.git","clone_url":"https://github.com/eucalyptus/eucalyptus-service-image.git","svn_url":"https://github.com/eucalyptus/eucalyptus-service-image","homepage":null,"size":428,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"eucalyptus:master","ref":"master","sha":"4a8f7ef9e2f37583193171be200e38a605561bed","user":{"login":"eucalyptus","id":808244,"avatar_url":"https://avatars.githubusercontent.com/u/808244?v=3","gravatar_id":"","url":"https://api.github.com/users/eucalyptus","html_url":"https://github.com/eucalyptus","followers_url":"https://api.github.com/users/eucalyptus/followers","following_url":"https://api.github.com/users/eucalyptus/following{/other_user}","gists_url":"https://api.github.com/users/eucalyptus/gists{/gist_id}","starred_url":"https://api.github.com/users/eucalyptus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eucalyptus/subscriptions","organizations_url":"https://api.github.com/users/eucalyptus/orgs","repos_url":"https://api.github.com/users/eucalyptus/repos","events_url":"https://api.github.com/users/eucalyptus/events{/privacy}","received_events_url":"https://api.github.com/users/eucalyptus/received_events","type":"Organization","site_admin":false},"repo":{"id":27593561,"name":"eucalyptus-service-image","full_name":"eucalyptus/eucalyptus-service-image","owner":{"login":"eucalyptus","id":808244,"avatar_url":"https://avatars.githubusercontent.com/u/808244?v=3","gravatar_id":"","url":"https://api.github.com/users/eucalyptus","html_url":"https://github.com/eucalyptus","followers_url":"https://api.github.com/users/eucalyptus/followers","following_url":"https://api.github.com/users/eucalyptus/following{/other_user}","gists_url":"https://api.github.com/users/eucalyptus/gists{/gist_id}","starred_url":"https://api.github.com/users/eucalyptus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eucalyptus/subscriptions","organizations_url":"https://api.github.com/users/eucalyptus/orgs","repos_url":"https://api.github.com/users/eucalyptus/repos","events_url":"https://api.github.com/users/eucalyptus/events{/privacy}","received_events_url":"https://api.github.com/users/eucalyptus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eucalyptus/eucalyptus-service-image","description":"Code for building an RPM containing VM image with multiple Eucalyptus services","fork":false,"url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image","forks_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/forks","keys_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/teams","hooks_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/hooks","issue_events_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/issues/events{/number}","events_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/events","assignees_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/assignees{/user}","branches_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/branches{/branch}","tags_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/tags","blobs_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/statuses/{sha}","languages_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/languages","stargazers_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/stargazers","contributors_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/contributors","subscribers_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/subscribers","subscription_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/subscription","commits_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/contents/{+path}","compare_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/merges","archive_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/downloads","issues_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/issues{/number}","pulls_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls{/number}","milestones_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/milestones{/number}","notifications_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/labels{/name}","releases_url":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/releases{/id}","created_at":"2014-12-05T13:52:09Z","updated_at":"2015-05-01T00:31:40Z","pushed_at":"2015-09-28T23:49:03Z","git_url":"git://github.com/eucalyptus/eucalyptus-service-image.git","ssh_url":"git@github.com:eucalyptus/eucalyptus-service-image.git","clone_url":"https://github.com/eucalyptus/eucalyptus-service-image.git","svn_url":"https://github.com/eucalyptus/eucalyptus-service-image","homepage":null,"size":428,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/13"},"html":{"href":"https://github.com/eucalyptus/eucalyptus-service-image/pull/13"},"issue":{"href":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/issues/13"},"comments":{"href":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/eucalyptus/eucalyptus-service-image/statuses/4cb22b7c4ef426c343caff7cba209b62dc05c1ee"}}}}