Merge lp:~veebers/juju-ci-tools/flyby-cleanup-jimm-remove-try into lp:juju-ci-tools

Proposed by Christopher Lee
Status: Merged
Merged at revision: 1922
Proposed branch: lp:~veebers/juju-ci-tools/flyby-cleanup-jimm-remove-try
Merge into: lp:juju-ci-tools
Diff against target: 45 lines (+15/-20)
1 file modified
jujupy/client.py (+15/-20)
To merge this branch: bzr merge lp:~veebers/juju-ci-tools/flyby-cleanup-jimm-remove-try
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+318716@code.launchpad.net

Commit message

Remove try/except/TIMEOUT from register_host as the raised exception is useful as is.

Description of the change

Remove try/except/TIMEOUT from register_host as the raised exception is useful as is.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'jujupy/client.py'
2--- jujupy/client.py 2017-03-01 19:02:24 +0000
3+++ jujupy/client.py 2017-03-02 04:22:47 +0000
4@@ -2650,26 +2650,21 @@
5 def register_host(self, host, email, password):
6 child = self.expect('register', ('--no-browser-login', host),
7 include_e=False)
8- try:
9- child.logfile = sys.stdout
10- child.expect('E-Mail:|Enter a name for this controller:')
11- if child.match.group(0) == 'E-Mail:':
12- child.sendline(email)
13- child.expect('Password:')
14- child.logfile = None
15- try:
16- child.sendline(password)
17- finally:
18- child.logfile = sys.stdout
19- child.expect(r'Two-factor auth \(Enter for none\):')
20- child.sendline()
21- child.expect('Enter a name for this controller:')
22- child.sendline(self.env.controller.name)
23- child.expect(pexpect.EOF)
24- except pexpect.TIMEOUT:
25- raise
26- raise Exception(
27- 'Registering user failed: pexpect session timed out')
28+ child.logfile = sys.stdout
29+ child.expect('E-Mail:|Enter a name for this controller:')
30+ if child.match.group(0) == 'E-Mail:':
31+ child.sendline(email)
32+ child.expect('Password:')
33+ child.logfile = None
34+ try:
35+ child.sendline(password)
36+ finally:
37+ child.logfile = sys.stdout
38+ child.expect(r'Two-factor auth \(Enter for none\):')
39+ child.sendline()
40+ child.expect('Enter a name for this controller:')
41+ child.sendline(self.env.controller.name)
42+ child.expect(pexpect.EOF)
43
44 def remove_user(self, username):
45 self.juju('remove-user', (username, '-y'), include_e=False)

Subscribers

People subscribed via source and target branches