{"action":"created","comment":{"url":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/comments/65116712","id":65116712,"diff_hunk":"@@ -59,25 +54,42 @@ def logout():\n \n \n def upload(snap_filename):\n-    if not os.path.exists(snap_filename):\n-        raise FileNotFoundError(snap_filename)\n-    else:\n-        snap_name = _get_name_from_snap_file(snap_filename)\n-        logger.info('Uploading existing {}.'.format(snap_filename))\n+    logger.info('Uploading existing {}.'.format(snap_filename))\n \n-        storeapi.upload(snap_filename, snap_name)\n+    try:\n+        store = storeapi.StoreClient()\n+        result = store.upload(snap_filename)\n+    except storeapi.InvalidCredentialsError:\n+        logger.info('No valid credentials found.'\n+                    ' Have you run \"snapcraft login\"?')\n+        return\n \n+    success = result.get('success', False)\n+    errors = result.get('errors', [])\n+    app_url = result.get('application_url', '')\n+    revision = result.get('revision')\n \n-def _get_name_from_snap_file(snap_path):\n-    with tempfile.TemporaryDirectory() as temp_dir:\n-        subprocess.check_call(\n-            ['unsquashfs', '-d', os.path.join(temp_dir, 'squashfs-root'),\n-             snap_path, '-e', os.path.join('meta', 'snap.yaml')])\n-        with open(os.path.join(\n-                temp_dir, 'squashfs-root', 'meta', 'snap.yaml')) as yaml_file:\n-            snap_yaml = yaml.load(yaml_file)\n+    # Print another newline to make sure the user sees the final result of the\n+    # upload (success/failure).\n+    logger.info('')\n \n-    return snap_yaml['name']\n+    if success:\n+        message = 'Application uploaded successfully'\n+        if revision:\n+            message += ' (as revision {})'.format(revision)","path":"snapcraft/_store.py","position":53,"original_position":53,"commit_id":"993a8464c42d03599d8100e646b843bc60d7248d","original_commit_id":"993a8464c42d03599d8100e646b843bc60d7248d","user":{"login":"sergiusens","id":1146853,"avatar_url":"https://avatars.githubusercontent.com/u/1146853?v=3","gravatar_id":"","url":"https://api.github.com/users/sergiusens","html_url":"https://github.com/sergiusens","followers_url":"https://api.github.com/users/sergiusens/followers","following_url":"https://api.github.com/users/sergiusens/following{/other_user}","gists_url":"https://api.github.com/users/sergiusens/gists{/gist_id}","starred_url":"https://api.github.com/users/sergiusens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergiusens/subscriptions","organizations_url":"https://api.github.com/users/sergiusens/orgs","repos_url":"https://api.github.com/users/sergiusens/repos","events_url":"https://api.github.com/users/sergiusens/events{/privacy}","received_events_url":"https://api.github.com/users/sergiusens/received_events","type":"User","site_admin":false},"body":"Why not `'{} (as revision {})'.format(message, revision)` ?","created_at":"2016-05-31T02:24:44Z","updated_at":"2016-05-31T02:24:45Z","html_url":"https://github.com/ubuntu-core/snapcraft/pull/531#discussion_r65116712","pull_request_url":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/531","_links":{"self":{"href":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/comments/65116712"},"html":{"href":"https://github.com/ubuntu-core/snapcraft/pull/531#discussion_r65116712"},"pull_request":{"href":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/531"}}},"pull_request":{"url":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/531","id":71844583,"html_url":"https://github.com/ubuntu-core/snapcraft/pull/531","diff_url":"https://github.com/ubuntu-core/snapcraft/pull/531.diff","patch_url":"https://github.com/ubuntu-core/snapcraft/pull/531.patch","issue_url":"https://api.github.com/repos/ubuntu-core/snapcraft/issues/531","number":531,"state":"open","locked":false,"title":"Moved the upload to the store client.","user":{"login":"elopio","id":617831,"avatar_url":"https://avatars.githubusercontent.com/u/617831?v=3","gravatar_id":"","url":"https://api.github.com/users/elopio","html_url":"https://github.com/elopio","followers_url":"https://api.github.com/users/elopio/followers","following_url":"https://api.github.com/users/elopio/following{/other_user}","gists_url":"https://api.github.com/users/elopio/gists{/gist_id}","starred_url":"https://api.github.com/users/elopio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elopio/subscriptions","organizations_url":"https://api.github.com/users/elopio/orgs","repos_url":"https://api.github.com/users/elopio/repos","events_url":"https://api.github.com/users/elopio/events{/privacy}","received_events_url":"https://api.github.com/users/elopio/received_events","type":"User","site_admin":false},"body":"LP: #1586874","created_at":"2016-05-30T01:45:13Z","updated_at":"2016-05-31T02:24:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a4f07e86476e09d68f5f61eedd58fd44a2b279fb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/531/commits","review_comments_url":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/531/comments","review_comment_url":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ubuntu-core/snapcraft/issues/531/comments","statuses_url":"https://api.github.com/repos/ubuntu-core/snapcraft/statuses/993a8464c42d03599d8100e646b843bc60d7248d","head":{"label":"elopio:macaroons4","ref":"macaroons4","sha":"993a8464c42d03599d8100e646b843bc60d7248d","user":{"login":"elopio","id":617831,"avatar_url":"https://avatars.githubusercontent.com/u/617831?v=3","gravatar_id":"","url":"https://api.github.com/users/elopio","html_url":"https://github.com/elopio","followers_url":"https://api.github.com/users/elopio/followers","following_url":"https://api.github.com/users/elopio/following{/other_user}","gists_url":"https://api.github.com/users/elopio/gists{/gist_id}","starred_url":"https://api.github.com/users/elopio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elopio/subscriptions","organizations_url":"https://api.github.com/users/elopio/orgs","repos_url":"https://api.github.com/users/elopio/repos","events_url":"https://api.github.com/users/elopio/events{/privacy}","received_events_url":"https://api.github.com/users/elopio/received_events","type":"User","site_admin":false},"repo":{"id":45211576,"name":"snapcraft","full_name":"elopio/snapcraft","owner":{"login":"elopio","id":617831,"avatar_url":"https://avatars.githubusercontent.com/u/617831?v=3","gravatar_id":"","url":"https://api.github.com/users/elopio","html_url":"https://github.com/elopio","followers_url":"https://api.github.com/users/elopio/followers","following_url":"https://api.github.com/users/elopio/following{/other_user}","gists_url":"https://api.github.com/users/elopio/gists{/gist_id}","starred_url":"https://api.github.com/users/elopio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elopio/subscriptions","organizations_url":"https://api.github.com/users/elopio/orgs","repos_url":"https://api.github.com/users/elopio/repos","events_url":"https://api.github.com/users/elopio/events{/privacy}","received_events_url":"https://api.github.com/users/elopio/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/elopio/snapcraft","description":"Snapcraft is a delightful packaging tool","fork":true,"url":"https://api.github.com/repos/elopio/snapcraft","forks_url":"https://api.github.com/repos/elopio/snapcraft/forks","keys_url":"https://api.github.com/repos/elopio/snapcraft/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elopio/snapcraft/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elopio/snapcraft/teams","hooks_url":"https://api.github.com/repos/elopio/snapcraft/hooks","issue_events_url":"https://api.github.com/repos/elopio/snapcraft/issues/events{/number}","events_url":"https://api.github.com/repos/elopio/snapcraft/events","assignees_url":"https://api.github.com/repos/elopio/snapcraft/assignees{/user}","branches_url":"https://api.github.com/repos/elopio/snapcraft/branches{/branch}","tags_url":"https://api.github.com/repos/elopio/snapcraft/tags","blobs_url":"https://api.github.com/repos/elopio/snapcraft/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elopio/snapcraft/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elopio/snapcraft/git/refs{/sha}","trees_url":"https://api.github.com/repos/elopio/snapcraft/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elopio/snapcraft/statuses/{sha}","languages_url":"https://api.github.com/repos/elopio/snapcraft/languages","stargazers_url":"https://api.github.com/repos/elopio/snapcraft/stargazers","contributors_url":"https://api.github.com/repos/elopio/snapcraft/contributors","subscribers_url":"https://api.github.com/repos/elopio/snapcraft/subscribers","subscription_url":"https://api.github.com/repos/elopio/snapcraft/subscription","commits_url":"https://api.github.com/repos/elopio/snapcraft/commits{/sha}","git_commits_url":"https://api.github.com/repos/elopio/snapcraft/git/commits{/sha}","comments_url":"https://api.github.com/repos/elopio/snapcraft/comments{/number}","issue_comment_url":"https://api.github.com/repos/elopio/snapcraft/issues/comments{/number}","contents_url":"https://api.github.com/repos/elopio/snapcraft/contents/{+path}","compare_url":"https://api.github.com/repos/elopio/snapcraft/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elopio/snapcraft/merges","archive_url":"https://api.github.com/repos/elopio/snapcraft/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elopio/snapcraft/downloads","issues_url":"https://api.github.com/repos/elopio/snapcraft/issues{/number}","pulls_url":"https://api.github.com/repos/elopio/snapcraft/pulls{/number}","milestones_url":"https://api.github.com/repos/elopio/snapcraft/milestones{/number}","notifications_url":"https://api.github.com/repos/elopio/snapcraft/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elopio/snapcraft/labels{/name}","releases_url":"https://api.github.com/repos/elopio/snapcraft/releases{/id}","deployments_url":"https://api.github.com/repos/elopio/snapcraft/deployments","created_at":"2015-10-29T21:26:41Z","updated_at":"2016-01-11T20:05:34Z","pushed_at":"2016-05-31T01:58:44Z","git_url":"git://github.com/elopio/snapcraft.git","ssh_url":"git@github.com:elopio/snapcraft.git","clone_url":"https://github.com/elopio/snapcraft.git","svn_url":"https://github.com/elopio/snapcraft","homepage":null,"size":4067,"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":"master"}},"base":{"label":"ubuntu-core:master","ref":"master","sha":"0425b6375352680a5255e7cbeeac1e7a16c4b099","user":{"login":"ubuntu-core","id":15022473,"avatar_url":"https://avatars.githubusercontent.com/u/15022473?v=3","gravatar_id":"","url":"https://api.github.com/users/ubuntu-core","html_url":"https://github.com/ubuntu-core","followers_url":"https://api.github.com/users/ubuntu-core/followers","following_url":"https://api.github.com/users/ubuntu-core/following{/other_user}","gists_url":"https://api.github.com/users/ubuntu-core/gists{/gist_id}","starred_url":"https://api.github.com/users/ubuntu-core/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubuntu-core/subscriptions","organizations_url":"https://api.github.com/users/ubuntu-core/orgs","repos_url":"https://api.github.com/users/ubuntu-core/repos","events_url":"https://api.github.com/users/ubuntu-core/events{/privacy}","received_events_url":"https://api.github.com/users/ubuntu-core/received_events","type":"Organization","site_admin":false},"repo":{"id":45199136,"name":"snapcraft","full_name":"ubuntu-core/snapcraft","owner":{"login":"ubuntu-core","id":15022473,"avatar_url":"https://avatars.githubusercontent.com/u/15022473?v=3","gravatar_id":"","url":"https://api.github.com/users/ubuntu-core","html_url":"https://github.com/ubuntu-core","followers_url":"https://api.github.com/users/ubuntu-core/followers","following_url":"https://api.github.com/users/ubuntu-core/following{/other_user}","gists_url":"https://api.github.com/users/ubuntu-core/gists{/gist_id}","starred_url":"https://api.github.com/users/ubuntu-core/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubuntu-core/subscriptions","organizations_url":"https://api.github.com/users/ubuntu-core/orgs","repos_url":"https://api.github.com/users/ubuntu-core/repos","events_url":"https://api.github.com/users/ubuntu-core/events{/privacy}","received_events_url":"https://api.github.com/users/ubuntu-core/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ubuntu-core/snapcraft","description":"Snapcraft is a delightful packaging tool","fork":false,"url":"https://api.github.com/repos/ubuntu-core/snapcraft","forks_url":"https://api.github.com/repos/ubuntu-core/snapcraft/forks","keys_url":"https://api.github.com/repos/ubuntu-core/snapcraft/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ubuntu-core/snapcraft/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ubuntu-core/snapcraft/teams","hooks_url":"https://api.github.com/repos/ubuntu-core/snapcraft/hooks","issue_events_url":"https://api.github.com/repos/ubuntu-core/snapcraft/issues/events{/number}","events_url":"https://api.github.com/repos/ubuntu-core/snapcraft/events","assignees_url":"https://api.github.com/repos/ubuntu-core/snapcraft/assignees{/user}","branches_url":"https://api.github.com/repos/ubuntu-core/snapcraft/branches{/branch}","tags_url":"https://api.github.com/repos/ubuntu-core/snapcraft/tags","blobs_url":"https://api.github.com/repos/ubuntu-core/snapcraft/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ubuntu-core/snapcraft/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ubuntu-core/snapcraft/git/refs{/sha}","trees_url":"https://api.github.com/repos/ubuntu-core/snapcraft/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ubuntu-core/snapcraft/statuses/{sha}","languages_url":"https://api.github.com/repos/ubuntu-core/snapcraft/languages","stargazers_url":"https://api.github.com/repos/ubuntu-core/snapcraft/stargazers","contributors_url":"https://api.github.com/repos/ubuntu-core/snapcraft/contributors","subscribers_url":"https://api.github.com/repos/ubuntu-core/snapcraft/subscribers","subscription_url":"https://api.github.com/repos/ubuntu-core/snapcraft/subscription","commits_url":"https://api.github.com/repos/ubuntu-core/snapcraft/commits{/sha}","git_commits_url":"https://api.github.com/repos/ubuntu-core/snapcraft/git/commits{/sha}","comments_url":"https://api.github.com/repos/ubuntu-core/snapcraft/comments{/number}","issue_comment_url":"https://api.github.com/repos/ubuntu-core/snapcraft/issues/comments{/number}","contents_url":"https://api.github.com/repos/ubuntu-core/snapcraft/contents/{+path}","compare_url":"https://api.github.com/repos/ubuntu-core/snapcraft/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ubuntu-core/snapcraft/merges","archive_url":"https://api.github.com/repos/ubuntu-core/snapcraft/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ubuntu-core/snapcraft/downloads","issues_url":"https://api.github.com/repos/ubuntu-core/snapcraft/issues{/number}","pulls_url":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls{/number}","milestones_url":"https://api.github.com/repos/ubuntu-core/snapcraft/milestones{/number}","notifications_url":"https://api.github.com/repos/ubuntu-core/snapcraft/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ubuntu-core/snapcraft/labels{/name}","releases_url":"https://api.github.com/repos/ubuntu-core/snapcraft/releases{/id}","deployments_url":"https://api.github.com/repos/ubuntu-core/snapcraft/deployments","created_at":"2015-10-29T17:23:15Z","updated_at":"2016-05-29T19:14:06Z","pushed_at":"2016-05-31T02:17:45Z","git_url":"git://github.com/ubuntu-core/snapcraft.git","ssh_url":"git@github.com:ubuntu-core/snapcraft.git","clone_url":"https://github.com/ubuntu-core/snapcraft.git","svn_url":"https://github.com/ubuntu-core/snapcraft","homepage":null,"size":5310,"stargazers_count":121,"watchers_count":121,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":14,"forks":58,"open_issues":14,"watchers":121,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/531"},"html":{"href":"https://github.com/ubuntu-core/snapcraft/pull/531"},"issue":{"href":"https://api.github.com/repos/ubuntu-core/snapcraft/issues/531"},"comments":{"href":"https://api.github.com/repos/ubuntu-core/snapcraft/issues/531/comments"},"review_comments":{"href":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/531/comments"},"review_comment":{"href":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ubuntu-core/snapcraft/pulls/531/commits"},"statuses":{"href":"https://api.github.com/repos/ubuntu-core/snapcraft/statuses/993a8464c42d03599d8100e646b843bc60d7248d"}}}}
{"actor":{"display_login":"sergiusens"}}