Merge ~sylvain-pineau/checkbox-ng:submission-service-transport into checkbox-ng:master

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: d6610093f5f131767a9276fa0927948ecbd519ff
Merged at revision: ae284687b0e966738b0863c9fcf010032690662c
Proposed branch: ~sylvain-pineau/checkbox-ng:submission-service-transport
Merge into: checkbox-ng:master
Diff against target: 60 lines (+24/-3)
3 files modified
checkbox_ng/certification.py (+6/-3)
checkbox_ng/launcher/subcommands.py (+16/-0)
setup.py (+2/-0)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Maciej Kisielewski (community) Approve
Review via email: mp+319443@code.launchpad.net

Description of the change

New class to create a transport suitable for sending tar.xz submissions to the new service endpoint

To post a comment you must log in.
Revision history for this message
Maciej Kisielewski (kissiel) wrote :

+1! Great stuff.
One comment inline - I'm leaving the decision about this little clean-up up to you.

review: Approve
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

New (simplified) version without adding a new class since the new service ignores the header content.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/checkbox_ng/certification.py b/checkbox_ng/certification.py
2index a8ae820..def7e35 100644
3--- a/checkbox_ng/certification.py
4+++ b/checkbox_ng/certification.py
5@@ -46,9 +46,12 @@ class CertificationTransport(TransportBase):
6 Transport for sending data to certification database.
7 - POSTs data to a http(s) endpoint
8 - Adds a header with a hardware identifier
9- - Data is expected to be in checkbox xml-compatible format.
10- This means it will work best with a stream produced by the
11- xml exporter.
12+ - Payload can be in:
13+ * checkbox xml-compatible format.
14+ This means it will work best with a stream produced by the xml
15+ exporter.
16+ * LZMA compressed tarball that includes a submission.json and results
17+ from checkbox.
18 """
19
20 def __init__(self, where, options):
21diff --git a/checkbox_ng/launcher/subcommands.py b/checkbox_ng/launcher/subcommands.py
22index 8baa4e4..d560484 100644
23--- a/checkbox_ng/launcher/subcommands.py
24+++ b/checkbox_ng/launcher/subcommands.py
25@@ -527,6 +527,22 @@ class Launcher(Command, MainLoopStage):
26 else:
27 options = ""
28 self.transports[transport] = cls(url, options)
29+ elif tr_type == 'submission-service':
30+ secure_id = self.launcher.transports[transport].get(
31+ 'secure_id', None)
32+ if not secure_id and self.is_interactive:
33+ secure_id = input(self.C.BLUE(_('Enter secure-id:')))
34+ if secure_id:
35+ options = "secure_id={}".format(secure_id)
36+ else:
37+ options = ""
38+ if self.launcher.transports[transport].get('staging', False):
39+ url = ('https://submission.staging.canonical.com/'
40+ '1.0/submission/hardware/{}'.format(secure_id))
41+ else:
42+ url = ('https://submission.canonical.com/'
43+ '1.0/submission/hardware/{}'.format(secure_id))
44+ self.transports[transport] = cls(url, options)
45
46 def _export_results(self):
47 for report in self.launcher.stock_reports:
48diff --git a/setup.py b/setup.py
49index 1f88d18..84a0285 100755
50--- a/setup.py
51+++ b/setup.py
52@@ -74,6 +74,8 @@ setup(
53 'plainbox.transport': [
54 'certification='
55 'checkbox_ng.certification:CertificationTransport',
56+ 'submission-service='
57+ 'checkbox_ng.certification:CertificationTransport',
58 ],
59 },
60 include_package_data=True)

Subscribers

People subscribed via source and target branches