Merge ~pwlars/testflinger-cli:server-env into testflinger-cli:master

Proposed by Paul Larson
Status: Merged
Approved by: Paul Larson
Approved revision: 83061cf3de09539623cd1a5ccc304e1a9161b689
Merged at revision: 81e60f4eaab620a4f0f935a992e5753b058ad1a9
Proposed branch: ~pwlars/testflinger-cli:server-env
Merge into: testflinger-cli:master
Diff against target: 26 lines (+6/-0)
2 files modified
README.rst (+3/-0)
testflinger-cli (+3/-0)
Reviewer Review Type Date Requested Status
Maciej Kisielewski (community) Approve
Review via email: mp+325419@code.launchpad.net

Description of the change

Allow server to be specified with environment variable

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

LGTM +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/README.rst b/README.rst
2index 4ab1f4b..58ad977 100644
3--- a/README.rst
4+++ b/README.rst
5@@ -36,6 +36,9 @@ After installing testflinger-cli, you can get help by just running
6 To specify a different server to use, you can use the '--server'
7 parameter, otherwise it will default to the one running on
8 http://testflinger.canonical.com
9+You may also set the environment variable 'TESTFLINGER_SERVER' to
10+the URI of your server, and it will prefer that over the default
11+or the string specified by --server.
12
13 To submit a new test job, first create a yaml or json file containing
14 the job definition. Then run:
15diff --git a/testflinger-cli b/testflinger-cli
16index 3c071f5..d51b4f2 100755
17--- a/testflinger-cli
18+++ b/testflinger-cli
19@@ -36,6 +36,9 @@ if os.path.exists(os.path.join(basedir, 'setup.py')):
20 help='Testflinger server to use')
21 @click.pass_context
22 def cli(ctx, server):
23+ env_server = os.environ.get('TESTFLINGER_SERVER')
24+ if env_server:
25+ server = env_server
26 ctx.obj['conn'] = testflinger_cli.Client(server)
27
28

Subscribers

People subscribed via source and target branches