{"action":"created","comment":{"url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/comments/93225524","pull_request_review_id":13747109,"id":93225524,"diff_hunk":"@@ -0,0 +1,259 @@\n+# Copyright 2016 Cloudbase Solutions Srl\n+# All Rights Reserved.\n+#\n+#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n+#    not use this file except in compliance with the License. You may obtain\n+#    a copy of the License at\n+#\n+#         http://www.apache.org/licenses/LICENSE-2.0\n+#\n+#    Unless required by applicable law or agreed to in writing, software\n+#    distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+#    License for the specific language governing permissions and limitations\n+#    under the License.\n+\n+from __future__ import print_function\n+\n+import argparse\n+import os\n+import subprocess\n+import sys\n+import tempfile\n+\n+from argus.backends.tempest import manager\n+from argus.config import ci\n+from argus import exceptions\n+\n+import requests\n+import six\n+from six.moves import urllib_parse as urlparse\n+from os_testr import subunit2html\n+\n+\n+def _download_resource(url, location):\n+    \"\"\"Download a file from a remote url.\n+\n+    :param url: The URL that points to the resource\n+    :param location: Where to save the resource\n+    \"\"\"\n+    response = requests.get(url)\n+    if response.status_code != 200:\n+        raise exceptions.ArgusEnvironmentError(\"Download failed, %s .\", url)\n+    with open(location, 'wb') as file_handle:\n+        file_handle.write(response.text)\n+\n+\n+def download_argus_resource(resource_path, location):\n+    \"\"\"Download an argus Resource.\n+\n+    :param resouce_path: Path of the resource relative to the\n+                         argus `resources` directory\n+    :param location: Where to save the resource\n+    \"\"\"\n+    base_url = ci.RESOURCES_LINK\n+    base_url = base_url.rsplit(\"/\", 1)[0]\n+\n+    url_resource = urlparse.urljoin(base_url,\n+                                    resource_path)\n+    _download_resource(url_resource, location)\n+\n+\n+def _get_images(image_id, image_name):\n+    \"\"\"Return a list with all the id's.\"\"\"\n+    images_list = []\n+    if image_id:\n+        try:\n+            mng = manager.APIManager()\n+            images = mng.image_client.list_images()[\"images\"]\n+            for img_id in image_id:\n+                img_name = \"\"\n+                for image in images:\n+                    if image[\"id\"].lower() == img_id.lower():\n+                        img_name = image[\"name\"].lower()\n+                        break\n+                images_list.append((img_id, img_name))\n+        finally:\n+            mng.cleanup_credentials()\n+    elif image_name:\n+        try:\n+            mng = manager.APIManager()\n+            images = mng.image_client.list_images()[\"images\"]\n+            for img_name in image_name:\n+                img_id = \"\"\n+                for image in images:\n+                    if image[\"name\"].lower() == img_name.lower():\n+                        img_id = image[\"id\"].lower()\n+                        break\n+                images_list.append((img_id, img_name))\n+        finally:\n+            mng.cleanup_credentials()\n+\n+    # filter unknow images\n+    for image in images_list:\n+        if not image[0] or not image[1]:\n+            images_list.remove(image)\n+            print(\"[ERROR] Invalid image imformation id: {} - name: {}\".format(\n+                image[0], image[1]))\n+\n+    return images_list\n+\n+\n+def _get_base_directory(directory):\n+    \"\"\"Return the path to the root directory for this run.\"\"\"\n+    if directory:\n+        if not os.path.isdir(directory):\n+            os.mkdir(directory)\n+        directory = directory\n+    else:\n+        directory = tempfile.mkdtemp(prefix=\"argus-\", dir=\"/tmp\")\n+    return os.path.abspath(directory)\n+\n+\n+def _prepare_argument_parser():\n+    \"\"\"Prepare the argument parser.\"\"\"\n+    parser = argparse.ArgumentParser()\n+    parser.add_argument(\"-d\", \"--directory\",","path":"argus/shell.py","position":116,"original_position":116,"commit_id":"535cba94edc7467c9628cda5115c1cc1fbac6914","original_commit_id":"535cba94edc7467c9628cda5115c1cc1fbac6914","user":{"login":"stefan-caraiman","id":7658071,"avatar_url":"https://avatars.githubusercontent.com/u/7658071?v=3","gravatar_id":"","url":"https://api.github.com/users/stefan-caraiman","html_url":"https://github.com/stefan-caraiman","followers_url":"https://api.github.com/users/stefan-caraiman/followers","following_url":"https://api.github.com/users/stefan-caraiman/following{/other_user}","gists_url":"https://api.github.com/users/stefan-caraiman/gists{/gist_id}","starred_url":"https://api.github.com/users/stefan-caraiman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefan-caraiman/subscriptions","organizations_url":"https://api.github.com/users/stefan-caraiman/orgs","repos_url":"https://api.github.com/users/stefan-caraiman/repos","events_url":"https://api.github.com/users/stefan-caraiman/events{/privacy}","received_events_url":"https://api.github.com/users/stefan-caraiman/received_events","type":"User","site_admin":false},"body":"We will need to also specify the architecture that we will be using.","created_at":"2016-12-20T12:14:04Z","updated_at":"2016-12-20T12:16:16Z","html_url":"https://github.com/cloudbase/cloudbase-init-ci/pull/76#discussion_r93225524","pull_request_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/comments/93225524"},"html":{"href":"https://github.com/cloudbase/cloudbase-init-ci/pull/76#discussion_r93225524"},"pull_request":{"href":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/76","id":97083995,"html_url":"https://github.com/cloudbase/cloudbase-init-ci/pull/76","diff_url":"https://github.com/cloudbase/cloudbase-init-ci/pull/76.diff","patch_url":"https://github.com/cloudbase/cloudbase-init-ci/pull/76.patch","issue_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/issues/76","number":76,"state":"open","locked":false,"title":"Add a basic CLI","user":{"login":"micumatei","id":4560298,"avatar_url":"https://avatars.githubusercontent.com/u/4560298?v=3","gravatar_id":"","url":"https://api.github.com/users/micumatei","html_url":"https://github.com/micumatei","followers_url":"https://api.github.com/users/micumatei/followers","following_url":"https://api.github.com/users/micumatei/following{/other_user}","gists_url":"https://api.github.com/users/micumatei/gists{/gist_id}","starred_url":"https://api.github.com/users/micumatei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micumatei/subscriptions","organizations_url":"https://api.github.com/users/micumatei/orgs","repos_url":"https://api.github.com/users/micumatei/repos","events_url":"https://api.github.com/users/micumatei/events{/privacy}","received_events_url":"https://api.github.com/users/micumatei/received_events","type":"User","site_admin":false},"body":"Add a basic CLI that will help with seting up an isolated\r\ndirectory for every argus run\r\n\r\nSigned-off-by: Micu Matei-Marius <mmicu@cloudbasesolutions.com>","created_at":"2016-12-08T09:14:15Z","updated_at":"2016-12-20T12:16:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe2efba34e91eaefad0c219ce23b49f030611ca6","assignee":{"login":"ader1990","id":1412442,"avatar_url":"https://avatars.githubusercontent.com/u/1412442?v=3","gravatar_id":"","url":"https://api.github.com/users/ader1990","html_url":"https://github.com/ader1990","followers_url":"https://api.github.com/users/ader1990/followers","following_url":"https://api.github.com/users/ader1990/following{/other_user}","gists_url":"https://api.github.com/users/ader1990/gists{/gist_id}","starred_url":"https://api.github.com/users/ader1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ader1990/subscriptions","organizations_url":"https://api.github.com/users/ader1990/orgs","repos_url":"https://api.github.com/users/ader1990/repos","events_url":"https://api.github.com/users/ader1990/events{/privacy}","received_events_url":"https://api.github.com/users/ader1990/received_events","type":"User","site_admin":false},"assignees":[{"login":"ader1990","id":1412442,"avatar_url":"https://avatars.githubusercontent.com/u/1412442?v=3","gravatar_id":"","url":"https://api.github.com/users/ader1990","html_url":"https://github.com/ader1990","followers_url":"https://api.github.com/users/ader1990/followers","following_url":"https://api.github.com/users/ader1990/following{/other_user}","gists_url":"https://api.github.com/users/ader1990/gists{/gist_id}","starred_url":"https://api.github.com/users/ader1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ader1990/subscriptions","organizations_url":"https://api.github.com/users/ader1990/orgs","repos_url":"https://api.github.com/users/ader1990/repos","events_url":"https://api.github.com/users/ader1990/events{/privacy}","received_events_url":"https://api.github.com/users/ader1990/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/76/commits","review_comments_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/76/comments","review_comment_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/issues/76/comments","statuses_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/statuses/535cba94edc7467c9628cda5115c1cc1fbac6914","head":{"label":"micumatei:poc/base_cli","ref":"poc/base_cli","sha":"535cba94edc7467c9628cda5115c1cc1fbac6914","user":{"login":"micumatei","id":4560298,"avatar_url":"https://avatars.githubusercontent.com/u/4560298?v=3","gravatar_id":"","url":"https://api.github.com/users/micumatei","html_url":"https://github.com/micumatei","followers_url":"https://api.github.com/users/micumatei/followers","following_url":"https://api.github.com/users/micumatei/following{/other_user}","gists_url":"https://api.github.com/users/micumatei/gists{/gist_id}","starred_url":"https://api.github.com/users/micumatei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micumatei/subscriptions","organizations_url":"https://api.github.com/users/micumatei/orgs","repos_url":"https://api.github.com/users/micumatei/repos","events_url":"https://api.github.com/users/micumatei/events{/privacy}","received_events_url":"https://api.github.com/users/micumatei/received_events","type":"User","site_admin":false},"repo":{"id":58729237,"name":"cloudbase-init-ci","full_name":"micumatei/cloudbase-init-ci","owner":{"login":"micumatei","id":4560298,"avatar_url":"https://avatars.githubusercontent.com/u/4560298?v=3","gravatar_id":"","url":"https://api.github.com/users/micumatei","html_url":"https://github.com/micumatei","followers_url":"https://api.github.com/users/micumatei/followers","following_url":"https://api.github.com/users/micumatei/following{/other_user}","gists_url":"https://api.github.com/users/micumatei/gists{/gist_id}","starred_url":"https://api.github.com/users/micumatei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micumatei/subscriptions","organizations_url":"https://api.github.com/users/micumatei/orgs","repos_url":"https://api.github.com/users/micumatei/repos","events_url":"https://api.github.com/users/micumatei/events{/privacy}","received_events_url":"https://api.github.com/users/micumatei/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/micumatei/cloudbase-init-ci","description":"Continuous integration testing framework for Cloudbase-Init","fork":true,"url":"https://api.github.com/repos/micumatei/cloudbase-init-ci","forks_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/forks","keys_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/keys{/key_id}","collaborators_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/teams","hooks_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/hooks","issue_events_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/issues/events{/number}","events_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/events","assignees_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/assignees{/user}","branches_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/branches{/branch}","tags_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/tags","blobs_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/git/refs{/sha}","trees_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/git/trees{/sha}","statuses_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/statuses/{sha}","languages_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/languages","stargazers_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/stargazers","contributors_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/contributors","subscribers_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/subscribers","subscription_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/subscription","commits_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/commits{/sha}","git_commits_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/git/commits{/sha}","comments_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/comments{/number}","issue_comment_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/issues/comments{/number}","contents_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/contents/{+path}","compare_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/compare/{base}...{head}","merges_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/merges","archive_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/downloads","issues_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/issues{/number}","pulls_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/pulls{/number}","milestones_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/milestones{/number}","notifications_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/labels{/name}","releases_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/releases{/id}","deployments_url":"https://api.github.com/repos/micumatei/cloudbase-init-ci/deployments","created_at":"2016-05-13T10:30:36Z","updated_at":"2016-11-01T15:20:00Z","pushed_at":"2016-12-15T13:06:35Z","git_url":"git://github.com/micumatei/cloudbase-init-ci.git","ssh_url":"git@github.com:micumatei/cloudbase-init-ci.git","clone_url":"https://github.com/micumatei/cloudbase-init-ci.git","svn_url":"https://github.com/micumatei/cloudbase-init-ci","homepage":null,"size":1263,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"cloudbase:master","ref":"master","sha":"db871e2ef08097ebf2ba2a4b5abb2b10a8320114","user":{"login":"cloudbase","id":2104303,"avatar_url":"https://avatars.githubusercontent.com/u/2104303?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudbase","html_url":"https://github.com/cloudbase","followers_url":"https://api.github.com/users/cloudbase/followers","following_url":"https://api.github.com/users/cloudbase/following{/other_user}","gists_url":"https://api.github.com/users/cloudbase/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudbase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudbase/subscriptions","organizations_url":"https://api.github.com/users/cloudbase/orgs","repos_url":"https://api.github.com/users/cloudbase/repos","events_url":"https://api.github.com/users/cloudbase/events{/privacy}","received_events_url":"https://api.github.com/users/cloudbase/received_events","type":"Organization","site_admin":false},"repo":{"id":30780249,"name":"cloudbase-init-ci","full_name":"cloudbase/cloudbase-init-ci","owner":{"login":"cloudbase","id":2104303,"avatar_url":"https://avatars.githubusercontent.com/u/2104303?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudbase","html_url":"https://github.com/cloudbase","followers_url":"https://api.github.com/users/cloudbase/followers","following_url":"https://api.github.com/users/cloudbase/following{/other_user}","gists_url":"https://api.github.com/users/cloudbase/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudbase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudbase/subscriptions","organizations_url":"https://api.github.com/users/cloudbase/orgs","repos_url":"https://api.github.com/users/cloudbase/repos","events_url":"https://api.github.com/users/cloudbase/events{/privacy}","received_events_url":"https://api.github.com/users/cloudbase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudbase/cloudbase-init-ci","description":"Continuous integration testing framework for Cloudbase-Init","fork":false,"url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci","forks_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/forks","keys_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/teams","hooks_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/hooks","issue_events_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/issues/events{/number}","events_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/events","assignees_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/assignees{/user}","branches_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/branches{/branch}","tags_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/tags","blobs_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/languages","stargazers_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/stargazers","contributors_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/contributors","subscribers_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/subscribers","subscription_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/subscription","commits_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/contents/{+path}","compare_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/merges","archive_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/downloads","issues_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/issues{/number}","pulls_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/labels{/name}","releases_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/releases{/id}","deployments_url":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/deployments","created_at":"2015-02-13T23:09:06Z","updated_at":"2016-10-31T12:15:20Z","pushed_at":"2016-12-20T08:33:56Z","git_url":"git://github.com/cloudbase/cloudbase-init-ci.git","ssh_url":"git@github.com:cloudbase/cloudbase-init-ci.git","clone_url":"https://github.com/cloudbase/cloudbase-init-ci.git","svn_url":"https://github.com/cloudbase/cloudbase-init-ci","homepage":null,"size":1209,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":6,"forks":9,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/76"},"html":{"href":"https://github.com/cloudbase/cloudbase-init-ci/pull/76"},"issue":{"href":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/issues/76"},"comments":{"href":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/cloudbase/cloudbase-init-ci/statuses/535cba94edc7467c9628cda5115c1cc1fbac6914"}}}}
{"actor":{"display_login":"stefan-caraiman"}}