{"action":"created","comment":{"url":"https://api.github.com/repos/dcos/dcos-cli/pulls/comments/69031464","id":69031464,"diff_hunk":"@@ -65,12 +72,303 @@ def _cmds():\n             function=_ssh),\n \n         cmds.Command(\n+            hierarchy=['node', 'snapshot', 'create'],\n+            arg_keys=['<nodes>'],\n+            function=_snapshot_create),\n+\n+        cmds.Command(\n+            hierarchy=['node', 'snapshot', 'delete'],\n+            arg_keys=['<snapshot>'],\n+            function=_snapshot_delete),\n+\n+        cmds.Command(\n+            hierarchy=['node', 'snapshot', 'download'],\n+            arg_keys=['<snapshot>', '--location'],\n+            function=_snapshot_download),\n+\n+        cmds.Command(\n+            hierarchy=['node', 'snapshot'],\n+            arg_keys=['--list', '--status', '--cancel', '--json'],\n+            function=_snapshot_manage),\n+\n+        cmds.Command(\n             hierarchy=['node'],\n             arg_keys=['--json'],\n-            function=_list),\n+            function=_list)\n     ]\n \n \n+def snapshot_error(fn):\n+    @functools.wraps(fn)\n+    def check_for_snapshot_error(*args, **kwargs):\n+        response = fn(*args, **kwargs)\n+        if response.status_code != 200:\n+            err_msg = ('Error making {} request\\nURL: '\n+                       '{}, status_code: {}.'.format(args[1], args[0],\n+                                                     response.status_code))\n+            if not kwargs.get('stream'):\n+                err_status = _read_http_response_body(response).get('status')\n+                if err_status:\n+                    err_msg = err_status\n+            raise DCOSException(err_msg)\n+        return response\n+    return check_for_snapshot_error\n+\n+\n+def _check_3dt_version():\n+    if not http.check_cluster_capability('SUPPORT_CLUSTER_REPORT'):\n+        raise DCOSException(\n+            'DC/OS backend does not support snapshot capabilities in this '\n+            'version. Must be DC/OS >= 1.8')\n+\n+\n+def sizeof_fmt(num, suffix='B'):\n+    for unit in ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi']:\n+        if abs(num) < 1024.0:\n+            return \"%3.1f%s%s\" % (num, unit, suffix)\n+        num /= 1024.0\n+    return \"%.1f%s%s\" % (num, 'Yi', suffix)\n+\n+\n+def _get_snapshots_json():\n+    '''\n+    Get a json with a list of snapshots\n+\n+    :return: available snapshots on a cluster.\n+    :rtype: dict\n+    '''\n+    return _do_snapshot_request(SNAPSHOT_BASE_URL + '/list/all',\n+                                'GET')\n+\n+\n+def _get_snapshots_list():\n+    '''\n+    Get a list of tuples (snapshot_file_name, file_size), ..\n+\n+    :return: list of snapshots\n+    :rtype: list of tuples\n+    '''\n+    available_snapshots = []\n+    for _, snapshot_files in _get_snapshots_json().items():\n+        if snapshot_files is None:","path":"cli/dcoscli/node/main.py","position":110,"original_position":110,"commit_id":"68219234bd45aff7df2a89039083b12aa97e736a","original_commit_id":"68219234bd45aff7df2a89039083b12aa97e736a","user":{"login":"tamarrow","id":1292768,"avatar_url":"https://avatars.githubusercontent.com/u/1292768?v=3","gravatar_id":"","url":"https://api.github.com/users/tamarrow","html_url":"https://github.com/tamarrow","followers_url":"https://api.github.com/users/tamarrow/followers","following_url":"https://api.github.com/users/tamarrow/following{/other_user}","gists_url":"https://api.github.com/users/tamarrow/gists{/gist_id}","starred_url":"https://api.github.com/users/tamarrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamarrow/subscriptions","organizations_url":"https://api.github.com/users/tamarrow/orgs","repos_url":"https://api.github.com/users/tamarrow/repos","events_url":"https://api.github.com/users/tamarrow/events{/privacy}","received_events_url":"https://api.github.com/users/tamarrow/received_events","type":"User","site_admin":false},"body":"when would this be `None`? can we filter them out?","created_at":"2016-06-29T21:28:04Z","updated_at":"2016-06-29T21:28:04Z","html_url":"https://github.com/dcos/dcos-cli/pull/661#discussion_r69031464","pull_request_url":"https://api.github.com/repos/dcos/dcos-cli/pulls/661","_links":{"self":{"href":"https://api.github.com/repos/dcos/dcos-cli/pulls/comments/69031464"},"html":{"href":"https://github.com/dcos/dcos-cli/pull/661#discussion_r69031464"},"pull_request":{"href":"https://api.github.com/repos/dcos/dcos-cli/pulls/661"}}},"pull_request":{"url":"https://api.github.com/repos/dcos/dcos-cli/pulls/661","id":74708219,"html_url":"https://github.com/dcos/dcos-cli/pull/661","diff_url":"https://github.com/dcos/dcos-cli/pull/661.diff","patch_url":"https://github.com/dcos/dcos-cli/pull/661.patch","issue_url":"https://api.github.com/repos/dcos/dcos-cli/issues/661","number":661,"state":"open","locked":false,"title":"add snapshot to dcos cli","user":{"login":"darkonie","id":1162766,"avatar_url":"https://avatars.githubusercontent.com/u/1162766?v=3","gravatar_id":"","url":"https://api.github.com/users/darkonie","html_url":"https://github.com/darkonie","followers_url":"https://api.github.com/users/darkonie/followers","following_url":"https://api.github.com/users/darkonie/following{/other_user}","gists_url":"https://api.github.com/users/darkonie/gists{/gist_id}","starred_url":"https://api.github.com/users/darkonie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darkonie/subscriptions","organizations_url":"https://api.github.com/users/darkonie/orgs","repos_url":"https://api.github.com/users/darkonie/repos","events_url":"https://api.github.com/users/darkonie/events{/privacy}","received_events_url":"https://api.github.com/users/darkonie/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-22T00:38:12Z","updated_at":"2016-06-29T21:28:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88467b0ff0e5ea97ff9a9ec687aad48a314a8c1f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dcos/dcos-cli/pulls/661/commits","review_comments_url":"https://api.github.com/repos/dcos/dcos-cli/pulls/661/comments","review_comment_url":"https://api.github.com/repos/dcos/dcos-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dcos/dcos-cli/issues/661/comments","statuses_url":"https://api.github.com/repos/dcos/dcos-cli/statuses/68219234bd45aff7df2a89039083b12aa97e736a","head":{"label":"darkonie:mnaboka/add-snapshot","ref":"mnaboka/add-snapshot","sha":"68219234bd45aff7df2a89039083b12aa97e736a","user":{"login":"darkonie","id":1162766,"avatar_url":"https://avatars.githubusercontent.com/u/1162766?v=3","gravatar_id":"","url":"https://api.github.com/users/darkonie","html_url":"https://github.com/darkonie","followers_url":"https://api.github.com/users/darkonie/followers","following_url":"https://api.github.com/users/darkonie/following{/other_user}","gists_url":"https://api.github.com/users/darkonie/gists{/gist_id}","starred_url":"https://api.github.com/users/darkonie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darkonie/subscriptions","organizations_url":"https://api.github.com/users/darkonie/orgs","repos_url":"https://api.github.com/users/darkonie/repos","events_url":"https://api.github.com/users/darkonie/events{/privacy}","received_events_url":"https://api.github.com/users/darkonie/received_events","type":"User","site_admin":false},"repo":{"id":60862961,"name":"dcos-cli","full_name":"darkonie/dcos-cli","owner":{"login":"darkonie","id":1162766,"avatar_url":"https://avatars.githubusercontent.com/u/1162766?v=3","gravatar_id":"","url":"https://api.github.com/users/darkonie","html_url":"https://github.com/darkonie","followers_url":"https://api.github.com/users/darkonie/followers","following_url":"https://api.github.com/users/darkonie/following{/other_user}","gists_url":"https://api.github.com/users/darkonie/gists{/gist_id}","starred_url":"https://api.github.com/users/darkonie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darkonie/subscriptions","organizations_url":"https://api.github.com/users/darkonie/orgs","repos_url":"https://api.github.com/users/darkonie/repos","events_url":"https://api.github.com/users/darkonie/events{/privacy}","received_events_url":"https://api.github.com/users/darkonie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/darkonie/dcos-cli","description":"The command line for your datacenter! ","fork":true,"url":"https://api.github.com/repos/darkonie/dcos-cli","forks_url":"https://api.github.com/repos/darkonie/dcos-cli/forks","keys_url":"https://api.github.com/repos/darkonie/dcos-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/darkonie/dcos-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/darkonie/dcos-cli/teams","hooks_url":"https://api.github.com/repos/darkonie/dcos-cli/hooks","issue_events_url":"https://api.github.com/repos/darkonie/dcos-cli/issues/events{/number}","events_url":"https://api.github.com/repos/darkonie/dcos-cli/events","assignees_url":"https://api.github.com/repos/darkonie/dcos-cli/assignees{/user}","branches_url":"https://api.github.com/repos/darkonie/dcos-cli/branches{/branch}","tags_url":"https://api.github.com/repos/darkonie/dcos-cli/tags","blobs_url":"https://api.github.com/repos/darkonie/dcos-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/darkonie/dcos-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/darkonie/dcos-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/darkonie/dcos-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/darkonie/dcos-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/darkonie/dcos-cli/languages","stargazers_url":"https://api.github.com/repos/darkonie/dcos-cli/stargazers","contributors_url":"https://api.github.com/repos/darkonie/dcos-cli/contributors","subscribers_url":"https://api.github.com/repos/darkonie/dcos-cli/subscribers","subscription_url":"https://api.github.com/repos/darkonie/dcos-cli/subscription","commits_url":"https://api.github.com/repos/darkonie/dcos-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/darkonie/dcos-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/darkonie/dcos-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/darkonie/dcos-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/darkonie/dcos-cli/contents/{+path}","compare_url":"https://api.github.com/repos/darkonie/dcos-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/darkonie/dcos-cli/merges","archive_url":"https://api.github.com/repos/darkonie/dcos-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/darkonie/dcos-cli/downloads","issues_url":"https://api.github.com/repos/darkonie/dcos-cli/issues{/number}","pulls_url":"https://api.github.com/repos/darkonie/dcos-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/darkonie/dcos-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/darkonie/dcos-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/darkonie/dcos-cli/labels{/name}","releases_url":"https://api.github.com/repos/darkonie/dcos-cli/releases{/id}","deployments_url":"https://api.github.com/repos/darkonie/dcos-cli/deployments","created_at":"2016-06-10T16:46:21Z","updated_at":"2016-06-10T16:46:23Z","pushed_at":"2016-06-28T19:15:48Z","git_url":"git://github.com/darkonie/dcos-cli.git","ssh_url":"git@github.com:darkonie/dcos-cli.git","clone_url":"https://github.com/darkonie/dcos-cli.git","svn_url":"https://github.com/darkonie/dcos-cli","homepage":"http://docs.mesosphere.com/using/cli/","size":1933,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dcos:master","ref":"master","sha":"c5faea4ba1f9569406b97c179489e1ac62ed0f58","user":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"repo":{"id":26653348,"name":"dcos-cli","full_name":"dcos/dcos-cli","owner":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dcos/dcos-cli","description":"The command line for your datacenter! ","fork":false,"url":"https://api.github.com/repos/dcos/dcos-cli","forks_url":"https://api.github.com/repos/dcos/dcos-cli/forks","keys_url":"https://api.github.com/repos/dcos/dcos-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dcos/dcos-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dcos/dcos-cli/teams","hooks_url":"https://api.github.com/repos/dcos/dcos-cli/hooks","issue_events_url":"https://api.github.com/repos/dcos/dcos-cli/issues/events{/number}","events_url":"https://api.github.com/repos/dcos/dcos-cli/events","assignees_url":"https://api.github.com/repos/dcos/dcos-cli/assignees{/user}","branches_url":"https://api.github.com/repos/dcos/dcos-cli/branches{/branch}","tags_url":"https://api.github.com/repos/dcos/dcos-cli/tags","blobs_url":"https://api.github.com/repos/dcos/dcos-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dcos/dcos-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dcos/dcos-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/dcos/dcos-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dcos/dcos-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/dcos/dcos-cli/languages","stargazers_url":"https://api.github.com/repos/dcos/dcos-cli/stargazers","contributors_url":"https://api.github.com/repos/dcos/dcos-cli/contributors","subscribers_url":"https://api.github.com/repos/dcos/dcos-cli/subscribers","subscription_url":"https://api.github.com/repos/dcos/dcos-cli/subscription","commits_url":"https://api.github.com/repos/dcos/dcos-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/dcos/dcos-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/dcos/dcos-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/dcos/dcos-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/dcos/dcos-cli/contents/{+path}","compare_url":"https://api.github.com/repos/dcos/dcos-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dcos/dcos-cli/merges","archive_url":"https://api.github.com/repos/dcos/dcos-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dcos/dcos-cli/downloads","issues_url":"https://api.github.com/repos/dcos/dcos-cli/issues{/number}","pulls_url":"https://api.github.com/repos/dcos/dcos-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/dcos/dcos-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/dcos/dcos-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dcos/dcos-cli/labels{/name}","releases_url":"https://api.github.com/repos/dcos/dcos-cli/releases{/id}","deployments_url":"https://api.github.com/repos/dcos/dcos-cli/deployments","created_at":"2014-11-14T19:11:48Z","updated_at":"2016-06-29T01:57:32Z","pushed_at":"2016-06-29T20:34:19Z","git_url":"git://github.com/dcos/dcos-cli.git","ssh_url":"git@github.com:dcos/dcos-cli.git","clone_url":"https://github.com/dcos/dcos-cli.git","svn_url":"https://github.com/dcos/dcos-cli","homepage":"http://docs.mesosphere.com/using/cli/","size":2869,"stargazers_count":144,"watchers_count":144,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":36,"forks":61,"open_issues":36,"watchers":144,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dcos/dcos-cli/pulls/661"},"html":{"href":"https://github.com/dcos/dcos-cli/pull/661"},"issue":{"href":"https://api.github.com/repos/dcos/dcos-cli/issues/661"},"comments":{"href":"https://api.github.com/repos/dcos/dcos-cli/issues/661/comments"},"review_comments":{"href":"https://api.github.com/repos/dcos/dcos-cli/pulls/661/comments"},"review_comment":{"href":"https://api.github.com/repos/dcos/dcos-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dcos/dcos-cli/pulls/661/commits"},"statuses":{"href":"https://api.github.com/repos/dcos/dcos-cli/statuses/68219234bd45aff7df2a89039083b12aa97e736a"}}}}
{"actor":{"display_login":"tamarrow"}}