Merge lp:~vila/uci-engine/1300769-optional-tunnel into lp:uci-engine

Proposed by Vincent Ladeuil
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: 420
Merged at revision: 421
Proposed branch: lp:~vila/uci-engine/1300769-optional-tunnel
Merge into: lp:uci-engine
Diff against target: 63 lines (+16/-15)
1 file modified
tests/run.py (+16/-15)
To merge this branch: bzr merge lp:~vila/uci-engine/1300769-optional-tunnel
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Evan (community) Approve
Review via email: mp+213802@code.launchpad.net

Commit message

Be explicit about which env var is not set. OS_NETWORK_NAME is not needed, we use only one network.

Description of the change

Be explicit about which env var is not set.

To post a comment you must log in.
420. By Vincent Ladeuil

We don't need OS_NETWORK_NAME after all, there is only one network.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:419
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/469/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/469/rebuild

review: Approve (continuous-integration)
Revision history for this message
Evan (ev) wrote :

Looks good! +1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:420
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/470/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/470/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/run.py'
2--- tests/run.py 2014-04-01 15:02:54 +0000
3+++ tests/run.py 2014-04-02 10:41:30 +0000
4@@ -333,6 +333,8 @@
5 This is a pre-requisite to setup a tunnel.
6
7 :raises: NotFound if the instance has not been spawned.
8+
9+ :raises: Exception if no IP can be found after max_tries*3 seconds.
10 """
11
12 log.info("Getting the bootstrap IP address.")
13@@ -343,27 +345,25 @@
14 'service_type': 'compute'}
15 nt = client.Client(*args, **kwargs)
16
17- net = ''
18 tries = 0
19- network_name = os.environ['OS_NETWORK_NAME']
20 while tries < max_tries:
21 # Raises NotFound if the instance does not exist.
22 server = nt.servers.get(instance)
23- net = server.networks.get(network_name)
24- if net:
25- # Either we have a single address or the last one has been added to
26- # make the instance reachable (floating or public).
27- net = net[-1]
28- # Don't sleep anymore. We have our IP; break out of the loop.
29- break
30+ networks = server.networks.values()
31+ if networks:
32+ # We use a single network and don't care how it's named
33+ net = networks[0]
34+ if net:
35+ # Either we have a single address or the last one has been
36+ # added to make the instance reachable (floating or public).
37+ net = net[-1]
38+ # Don't sleep anymore. We have our IP, let's move on
39+ return net
40
41 tries += 1
42 if tries != max_tries:
43 time.sleep(3)
44- else:
45- raise Exception('Timed out waiting for bootstrap IP.')
46-
47- return net
48+ raise Exception('Timed out waiting for bootstrap IP.')
49
50
51 def destroy_tunnel():
52@@ -454,9 +454,10 @@
53
54 We assume that the targeted cloud is openstack based.
55 """
56- for key in ('OS_USERNAME', 'OS_NETWORK_NAME', 'OS_REQUIRES_TUNNEL'):
57+ for key in ('OS_USERNAME', 'OS_REQUIRES_TUNNEL'):
58 if os.environ.get(key, None) is None:
59- msg = 'Please source a novarc file before running this harness.'
60+ msg = ('Please source a novarc file before running this harness.'
61+ ' {} is not currently set'.format(key))
62 log.error(msg)
63 sys.exit(1)
64

Subscribers

People subscribed via source and target branches