Merge lp:~twom/launchpad/handle-manual-review-without-error into lp:launchpad

Proposed by Tom Wardill
Status: Merged
Merged at revision: 18990
Proposed branch: lp:~twom/launchpad/handle-manual-review-without-error
Merge into: lp:launchpad
Diff against target: 47 lines (+26/-0)
2 files modified
lib/lp/snappy/model/snapstoreclient.py (+5/-0)
lib/lp/snappy/tests/test_snapstoreclient.py (+21/-0)
To merge this branch: bzr merge lp:~twom/launchpad/handle-manual-review-without-error
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+369106@code.launchpad.net

Commit message

Manual Review should not fail the upload job

Description of the change

Now the release intent is moved to the dashboard, a snap upload entering the manual review stage should not be considered a job failure.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/snappy/model/snapstoreclient.py'
2--- lib/lp/snappy/model/snapstoreclient.py 2019-06-19 16:07:01 +0000
3+++ lib/lp/snappy/model/snapstoreclient.py 2019-06-20 16:46:42 +0000
4@@ -343,6 +343,11 @@
5 if not response_data["processed"]:
6 raise UploadNotScannedYetResponse()
7 elif "errors" in response_data:
8+ # This is returned as error in the upload,
9+ # but there is nothing we can do about it,
10+ # our upload has been successful
11+ if response_data['code'] == 'need_manual_review':
12+ return response_data["url"], response_data["revision"]
13 error_message = "\n".join(
14 error["message"] for error in response_data["errors"])
15 error_messages = []
16
17=== modified file 'lib/lp/snappy/tests/test_snapstoreclient.py'
18--- lib/lp/snappy/tests/test_snapstoreclient.py 2019-06-19 13:40:06 +0000
19+++ lib/lp/snappy/tests/test_snapstoreclient.py 2019-06-20 16:46:42 +0000
20@@ -621,6 +621,27 @@
21 self.client.checkStatus, status_url)
22
23 @responses.activate
24+ def test_checkStatus_manual_review(self):
25+ status_url = "http://sca.example/dev/api/snaps/1/builds/1/status"
26+ responses.add(
27+ "GET", status_url,
28+ json={
29+ "errors": [
30+ {"code": None,
31+ "link": None,
32+ "message": "found potentially sensitive files in package",
33+ }],
34+ "url": "http://sca.example/dev/click-apps/1/rev/1/",
35+ "code": "need_manual_review",
36+ "processed": True,
37+ "can_release": False,
38+ "revision": 1
39+ })
40+ self.assertEqual(
41+ ("http://sca.example/dev/click-apps/1/rev/1/", 1),
42+ self.client.checkStatus(status_url))
43+
44+ @responses.activate
45 def test_listChannels(self):
46 self._addChannelsResponse()
47 self.assertEqual(self.channels, self.client.listChannels())