Merge ~pwlars/testflinger-cli:fix-server-no-http into testflinger-cli:master

Proposed by Paul Larson
Status: Merged
Approved by: Paul Larson
Approved revision: 9bac40d413cb9e8b077b2a0cc7f312741845b564
Merged at revision: 5b41678cc5c8092f661ad32e1ead537640391579
Proposed branch: ~pwlars/testflinger-cli:fix-server-no-http
Merge into: testflinger-cli:master
Diff against target: 11 lines (+2/-0)
1 file modified
testflinger_cli/__init__.py (+2/-0)
Reviewer Review Type Date Requested Status
Jeff Lane  Approve
Sheila Miguez (community) Approve
Review via email: mp+383362@code.launchpad.net

Description of the change

Jeff pointed out that if you specify a server, but forget to put http:// or https:// in front of it, it gives you a big ugly traceback instead of something helpful. This fixes that.

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

lgtm

review: Approve
Revision history for this message
Jeff Lane  (bladernr) wrote :

Thanks for fixing that!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/testflinger_cli/__init__.py b/testflinger_cli/__init__.py
2index 563b2dd..f8aae93 100644
3--- a/testflinger_cli/__init__.py
4+++ b/testflinger_cli/__init__.py
5@@ -40,6 +40,8 @@ def cli(ctx, server):
6 env_server = os.environ.get('TESTFLINGER_SERVER')
7 if env_server:
8 server = env_server
9+ if not server.startswith(('http://','https://')):
10+ raise SystemExit('Server must start with "http://" or "https://"')
11 ctx.obj['conn'] = client.Client(server)
12
13

Subscribers

People subscribed via source and target branches