{"action":"created","comment":{"url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments/39986890","id":39986890,"diff_hunk":"@@ -1,28 +1,34 @@\n # -*- encoding: utf-8 -*-\n \"\"\"Generic base class for cli hammer commands.\"\"\"\n import logging\n-import re\n \n from robottelo import ssh\n from robottelo.cli import hammer\n from robottelo.config import conf\n \n \n-# Task status message have two formats:\n-#   * \"Task b18d3363-f4b8-44eb-871c-760e51444d22 success: 1.0/1, 100%,\n-#     elapsed: 00:00:02\\n\"\n-#   * \"Task 6ba9d82a-ea55-4934-8aab-0e057102ee11 running: 0.005/1, 0%, 0.0/s,\n-#     elapsed: 00:00:02, ETA: 00:06:55\\n\"\n-TASK_STATUS_REGEX = re.compile(\n-    r'Task [\\w-]+ \\w+: [\\d./]+, \\d+%,( [\\d./s]+,)? elapsed: [\\d:]+'\n-    '(, ETA: [\\d:]+)?\\n\\n?'\n-)\n-\n-\n class CLIError(Exception):\n     \"\"\"Indicates that a CLI command could not be run.\"\"\"\n \n \n+class CLIReturnCodeError(Exception):\n+    \"\"\"Indicates that a CLI command has finished with return code, different\n+    from zero.\n+\n+    :param return_code: CLI command return code\n+    :param stderr: contents of the ``stderr``\n+    :param msg: explanation of the error\n+\n+    \"\"\"\n+    def __init__(self, return_code, stderr, msg):\n+        self.return_code = return_code\n+        self.stderr = stderr\n+        self.msg = msg","path":"robottelo/cli/base.py","position":38,"original_position":38,"commit_id":"2480962c909e9c25ce986c5a90483ae4e57af23e","original_commit_id":"2480962c909e9c25ce986c5a90483ae4e57af23e","user":{"login":"elyezer","id":48132,"avatar_url":"https://avatars.githubusercontent.com/u/48132?v=3","gravatar_id":"","url":"https://api.github.com/users/elyezer","html_url":"https://github.com/elyezer","followers_url":"https://api.github.com/users/elyezer/followers","following_url":"https://api.github.com/users/elyezer/following{/other_user}","gists_url":"https://api.github.com/users/elyezer/gists{/gist_id}","starred_url":"https://api.github.com/users/elyezer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elyezer/subscriptions","organizations_url":"https://api.github.com/users/elyezer/orgs","repos_url":"https://api.github.com/users/elyezer/repos","events_url":"https://api.github.com/users/elyezer/events{/privacy}","received_events_url":"https://api.github.com/users/elyezer/received_events","type":"User","site_admin":false},"body":"Should not call the super __init__?","created_at":"2015-09-21T15:46:42Z","updated_at":"2015-09-21T15:46:42Z","html_url":"https://github.com/SatelliteQE/robottelo/pull/2778#discussion_r39986890","pull_request_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2778","_links":{"self":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments/39986890"},"html":{"href":"https://github.com/SatelliteQE/robottelo/pull/2778#discussion_r39986890"},"pull_request":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2778"}}},"pull_request":{"url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2778","id":45055122,"html_url":"https://github.com/SatelliteQE/robottelo/pull/2778","diff_url":"https://github.com/SatelliteQE/robottelo/pull/2778.diff","patch_url":"https://github.com/SatelliteQE/robottelo/pull/2778.patch","issue_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2778","number":2778,"state":"open","locked":false,"title":"CLI: Move SSHCommandResult processing to Base class","user":{"login":"abalakh","id":11719030,"avatar_url":"https://avatars.githubusercontent.com/u/11719030?v=3","gravatar_id":"","url":"https://api.github.com/users/abalakh","html_url":"https://github.com/abalakh","followers_url":"https://api.github.com/users/abalakh/followers","following_url":"https://api.github.com/users/abalakh/following{/other_user}","gists_url":"https://api.github.com/users/abalakh/gists{/gist_id}","starred_url":"https://api.github.com/users/abalakh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abalakh/subscriptions","organizations_url":"https://api.github.com/users/abalakh/orgs","repos_url":"https://api.github.com/users/abalakh/repos","events_url":"https://api.github.com/users/abalakh/events{/privacy}","received_events_url":"https://api.github.com/users/abalakh/received_events","type":"User","site_admin":false},"body":"Core part of #2776\r\n\r\n* Added new exception - `CLIReturnCodeError` which contains return_code, stderr and msg (message).\r\n* Created `Base._handle_response()` func which checks `return_code` and raises `CLIReturnCodeError` if needed. Returns `stdout`.\r\n* Injected `Base._handle_response()` in `Base.execute()` (that's the easiest place to inject, no existing commands won't be affected and nothing should be rewritten)\r\n* By default, all CLI commands running with `Base.execute()` will be wrapped by `Base._handle_response()`, if raw response is needed, `Base.execute()` now accepts optional parameter `return_raw_response`.\r\n* Removed `Base._remove_task_status()` in favour of `Base._handle_response()` `ignore_stderr` argument.","created_at":"2015-09-15T14:20:23Z","updated_at":"2015-09-21T15:46:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c65e85723b037b094eb77e76ef66932b538978d4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2778/commits","review_comments_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2778/comments","review_comment_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2778/comments","statuses_url":"https://api.github.com/repos/SatelliteQE/robottelo/statuses/2480962c909e9c25ce986c5a90483ae4e57af23e","head":{"label":"abalakh:cli_remove_return_code","ref":"cli_remove_return_code","sha":"2480962c909e9c25ce986c5a90483ae4e57af23e","user":{"login":"abalakh","id":11719030,"avatar_url":"https://avatars.githubusercontent.com/u/11719030?v=3","gravatar_id":"","url":"https://api.github.com/users/abalakh","html_url":"https://github.com/abalakh","followers_url":"https://api.github.com/users/abalakh/followers","following_url":"https://api.github.com/users/abalakh/following{/other_user}","gists_url":"https://api.github.com/users/abalakh/gists{/gist_id}","starred_url":"https://api.github.com/users/abalakh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abalakh/subscriptions","organizations_url":"https://api.github.com/users/abalakh/orgs","repos_url":"https://api.github.com/users/abalakh/repos","events_url":"https://api.github.com/users/abalakh/events{/privacy}","received_events_url":"https://api.github.com/users/abalakh/received_events","type":"User","site_admin":false},"repo":{"id":33126603,"name":"robottelo","full_name":"abalakh/robottelo","owner":{"login":"abalakh","id":11719030,"avatar_url":"https://avatars.githubusercontent.com/u/11719030?v=3","gravatar_id":"","url":"https://api.github.com/users/abalakh","html_url":"https://github.com/abalakh","followers_url":"https://api.github.com/users/abalakh/followers","following_url":"https://api.github.com/users/abalakh/following{/other_user}","gists_url":"https://api.github.com/users/abalakh/gists{/gist_id}","starred_url":"https://api.github.com/users/abalakh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abalakh/subscriptions","organizations_url":"https://api.github.com/users/abalakh/orgs","repos_url":"https://api.github.com/users/abalakh/repos","events_url":"https://api.github.com/users/abalakh/events{/privacy}","received_events_url":"https://api.github.com/users/abalakh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abalakh/robottelo","description":"Robottelo is a test suite which exercises The Foreman.","fork":true,"url":"https://api.github.com/repos/abalakh/robottelo","forks_url":"https://api.github.com/repos/abalakh/robottelo/forks","keys_url":"https://api.github.com/repos/abalakh/robottelo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abalakh/robottelo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abalakh/robottelo/teams","hooks_url":"https://api.github.com/repos/abalakh/robottelo/hooks","issue_events_url":"https://api.github.com/repos/abalakh/robottelo/issues/events{/number}","events_url":"https://api.github.com/repos/abalakh/robottelo/events","assignees_url":"https://api.github.com/repos/abalakh/robottelo/assignees{/user}","branches_url":"https://api.github.com/repos/abalakh/robottelo/branches{/branch}","tags_url":"https://api.github.com/repos/abalakh/robottelo/tags","blobs_url":"https://api.github.com/repos/abalakh/robottelo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abalakh/robottelo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abalakh/robottelo/git/refs{/sha}","trees_url":"https://api.github.com/repos/abalakh/robottelo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abalakh/robottelo/statuses/{sha}","languages_url":"https://api.github.com/repos/abalakh/robottelo/languages","stargazers_url":"https://api.github.com/repos/abalakh/robottelo/stargazers","contributors_url":"https://api.github.com/repos/abalakh/robottelo/contributors","subscribers_url":"https://api.github.com/repos/abalakh/robottelo/subscribers","subscription_url":"https://api.github.com/repos/abalakh/robottelo/subscription","commits_url":"https://api.github.com/repos/abalakh/robottelo/commits{/sha}","git_commits_url":"https://api.github.com/repos/abalakh/robottelo/git/commits{/sha}","comments_url":"https://api.github.com/repos/abalakh/robottelo/comments{/number}","issue_comment_url":"https://api.github.com/repos/abalakh/robottelo/issues/comments{/number}","contents_url":"https://api.github.com/repos/abalakh/robottelo/contents/{+path}","compare_url":"https://api.github.com/repos/abalakh/robottelo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abalakh/robottelo/merges","archive_url":"https://api.github.com/repos/abalakh/robottelo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abalakh/robottelo/downloads","issues_url":"https://api.github.com/repos/abalakh/robottelo/issues{/number}","pulls_url":"https://api.github.com/repos/abalakh/robottelo/pulls{/number}","milestones_url":"https://api.github.com/repos/abalakh/robottelo/milestones{/number}","notifications_url":"https://api.github.com/repos/abalakh/robottelo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abalakh/robottelo/labels{/name}","releases_url":"https://api.github.com/repos/abalakh/robottelo/releases{/id}","created_at":"2015-03-30T14:04:24Z","updated_at":"2015-05-07T13:12:41Z","pushed_at":"2015-09-18T13:17:32Z","git_url":"git://github.com/abalakh/robottelo.git","ssh_url":"git@github.com:abalakh/robottelo.git","clone_url":"https://github.com/abalakh/robottelo.git","svn_url":"https://github.com/abalakh/robottelo","homepage":"","size":9197,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"SatelliteQE:issue_2776","ref":"issue_2776","sha":"34057b3d92888c6104e11a33cd65f47348ab0bf1","user":{"login":"SatelliteQE","id":8754276,"avatar_url":"https://avatars.githubusercontent.com/u/8754276?v=3","gravatar_id":"","url":"https://api.github.com/users/SatelliteQE","html_url":"https://github.com/SatelliteQE","followers_url":"https://api.github.com/users/SatelliteQE/followers","following_url":"https://api.github.com/users/SatelliteQE/following{/other_user}","gists_url":"https://api.github.com/users/SatelliteQE/gists{/gist_id}","starred_url":"https://api.github.com/users/SatelliteQE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SatelliteQE/subscriptions","organizations_url":"https://api.github.com/users/SatelliteQE/orgs","repos_url":"https://api.github.com/users/SatelliteQE/repos","events_url":"https://api.github.com/users/SatelliteQE/events{/privacy}","received_events_url":"https://api.github.com/users/SatelliteQE/received_events","type":"Organization","site_admin":false},"repo":{"id":4000279,"name":"robottelo","full_name":"SatelliteQE/robottelo","owner":{"login":"SatelliteQE","id":8754276,"avatar_url":"https://avatars.githubusercontent.com/u/8754276?v=3","gravatar_id":"","url":"https://api.github.com/users/SatelliteQE","html_url":"https://github.com/SatelliteQE","followers_url":"https://api.github.com/users/SatelliteQE/followers","following_url":"https://api.github.com/users/SatelliteQE/following{/other_user}","gists_url":"https://api.github.com/users/SatelliteQE/gists{/gist_id}","starred_url":"https://api.github.com/users/SatelliteQE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SatelliteQE/subscriptions","organizations_url":"https://api.github.com/users/SatelliteQE/orgs","repos_url":"https://api.github.com/users/SatelliteQE/repos","events_url":"https://api.github.com/users/SatelliteQE/events{/privacy}","received_events_url":"https://api.github.com/users/SatelliteQE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SatelliteQE/robottelo","description":"Robottelo is a test suite which exercises The Foreman.","fork":false,"url":"https://api.github.com/repos/SatelliteQE/robottelo","forks_url":"https://api.github.com/repos/SatelliteQE/robottelo/forks","keys_url":"https://api.github.com/repos/SatelliteQE/robottelo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SatelliteQE/robottelo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SatelliteQE/robottelo/teams","hooks_url":"https://api.github.com/repos/SatelliteQE/robottelo/hooks","issue_events_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/events{/number}","events_url":"https://api.github.com/repos/SatelliteQE/robottelo/events","assignees_url":"https://api.github.com/repos/SatelliteQE/robottelo/assignees{/user}","branches_url":"https://api.github.com/repos/SatelliteQE/robottelo/branches{/branch}","tags_url":"https://api.github.com/repos/SatelliteQE/robottelo/tags","blobs_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/refs{/sha}","trees_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SatelliteQE/robottelo/statuses/{sha}","languages_url":"https://api.github.com/repos/SatelliteQE/robottelo/languages","stargazers_url":"https://api.github.com/repos/SatelliteQE/robottelo/stargazers","contributors_url":"https://api.github.com/repos/SatelliteQE/robottelo/contributors","subscribers_url":"https://api.github.com/repos/SatelliteQE/robottelo/subscribers","subscription_url":"https://api.github.com/repos/SatelliteQE/robottelo/subscription","commits_url":"https://api.github.com/repos/SatelliteQE/robottelo/commits{/sha}","git_commits_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/commits{/sha}","comments_url":"https://api.github.com/repos/SatelliteQE/robottelo/comments{/number}","issue_comment_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/comments{/number}","contents_url":"https://api.github.com/repos/SatelliteQE/robottelo/contents/{+path}","compare_url":"https://api.github.com/repos/SatelliteQE/robottelo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SatelliteQE/robottelo/merges","archive_url":"https://api.github.com/repos/SatelliteQE/robottelo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SatelliteQE/robottelo/downloads","issues_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues{/number}","pulls_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls{/number}","milestones_url":"https://api.github.com/repos/SatelliteQE/robottelo/milestones{/number}","notifications_url":"https://api.github.com/repos/SatelliteQE/robottelo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SatelliteQE/robottelo/labels{/name}","releases_url":"https://api.github.com/repos/SatelliteQE/robottelo/releases{/id}","created_at":"2012-04-12T01:36:39Z","updated_at":"2015-08-04T16:49:37Z","pushed_at":"2015-09-21T13:23:13Z","git_url":"git://github.com/SatelliteQE/robottelo.git","ssh_url":"git@github.com:SatelliteQE/robottelo.git","clone_url":"https://github.com/SatelliteQE/robottelo.git","svn_url":"https://github.com/SatelliteQE/robottelo","homepage":"","size":19625,"stargazers_count":23,"watchers_count":23,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":32,"mirror_url":null,"open_issues_count":221,"forks":32,"open_issues":221,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2778"},"html":{"href":"https://github.com/SatelliteQE/robottelo/pull/2778"},"issue":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2778"},"comments":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2778/comments"},"review_comments":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2778/comments"},"review_comment":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2778/commits"},"statuses":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/statuses/2480962c909e9c25ce986c5a90483ae4e57af23e"}}}}