Merge ~sylvain-pineau/checkbox-ng:c3url_envar into checkbox-ng:master

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: ae41b2e45c71871f8a4870a44da396e77ecdefd5
Merged at revision: 6c98d1f7a9db752fa343ba20e0176ca8fcb4ebdc
Proposed branch: ~sylvain-pineau/checkbox-ng:c3url_envar
Merge into: checkbox-ng:master
Diff against target: 27 lines (+5/-0)
2 files modified
checkbox_ng/launcher/stages.py (+3/-0)
checkbox_ng/launcher/subcommands.py (+2/-0)
Reviewer Review Type Date Requested Status
Sheila Miguez (community) Approve
Review via email: mp+387672@code.launchpad.net

Description of the change

Provide a way to modify the C3 url submission endpoint via this env variable.

To post a comment you must log in.
Revision history for this message
Sheila Miguez (codersquid) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/checkbox_ng/launcher/stages.py b/checkbox_ng/launcher/stages.py
2index 62633b2..380c22b 100644
3--- a/checkbox_ng/launcher/stages.py
4+++ b/checkbox_ng/launcher/stages.py
5@@ -415,6 +415,9 @@ class ReportsStage(CheckboxUiStage):
6 if self.sa.config.transports[transport].get('staging', False):
7 url = ('https://certification.staging.canonical.com/'
8 'api/v1/submission/{}/'.format(secure_id))
9+ elif os.getenv('C3_URL'):
10+ url = (
11+ '{}/{}/'.format(os.getenv('C3_URL'), ctx.args.secure_id))
12 else:
13 url = ('https://certification.canonical.com/'
14 'api/v1/submission/{}/'.format(secure_id))
15diff --git a/checkbox_ng/launcher/subcommands.py b/checkbox_ng/launcher/subcommands.py
16index 0432cdb..8c61c5d 100644
17--- a/checkbox_ng/launcher/subcommands.py
18+++ b/checkbox_ng/launcher/subcommands.py
19@@ -105,6 +105,8 @@ class Submit():
20 if ctx.args.staging:
21 url = ('https://certification.staging.canonical.com/'
22 'api/v1/submission/{}/'.format(ctx.args.secure_id))
23+ elif os.getenv('C3_URL'):
24+ url = ('{}/{}/'.format(os.getenv('C3_URL'), ctx.args.secure_id))
25 from checkbox_ng.certification import SubmissionServiceTransport
26 transport_cls = SubmissionServiceTransport
27 transport = transport_cls(url, options_string)

Subscribers

People subscribed via source and target branches