Merge lp:~greglange/swift/swuath_exit_codes into lp:~hudson-openstack/swift/trunk

Proposed by Greg Lange on 2011-04-18
Status: Merged
Approved by: David Goetz on 2011-04-18
Approved revision: 280
Merged at revision: 279
Proposed branch: lp:~greglange/swift/swuath_exit_codes
Merge into: lp:~hudson-openstack/swift/trunk
Diff against target: 97 lines (+12/-14)
8 files modified
bin/swauth-add-account (+1/-1)
bin/swauth-add-user (+1/-1)
bin/swauth-cleanup-tokens (+4/-6)
bin/swauth-delete-account (+1/-1)
bin/swauth-delete-user (+1/-1)
bin/swauth-list (+2/-2)
bin/swauth-prep (+1/-1)
bin/swauth-set-account-service (+1/-1)
To merge this branch: bzr merge lp:~greglange/swift/swuath_exit_codes
Reviewer Review Type Date Requested Status
Swift Core security contacts 2011-04-18 Pending
Review via email: mp+58151@code.launchpad.net

Description of the change

swauth scripts now exit with proper exit codes

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/swauth-add-account'
2--- bin/swauth-add-account 2011-03-24 22:51:44 +0000
3+++ bin/swauth-add-account 2011-04-18 16:12:34 +0000
4@@ -65,4 +65,4 @@
5 ssl=(parsed.scheme == 'https'))
6 resp = conn.getresponse()
7 if resp.status // 100 != 2:
8- print 'Account creation failed: %s %s' % (resp.status, resp.reason)
9+ exit('Account creation failed: %s %s' % (resp.status, resp.reason))
10
11=== modified file 'bin/swauth-add-user'
12--- bin/swauth-add-user 2011-03-24 22:51:44 +0000
13+++ bin/swauth-add-user 2011-04-18 16:12:34 +0000
14@@ -90,4 +90,4 @@
15 ssl=(parsed.scheme == 'https'))
16 resp = conn.getresponse()
17 if resp.status // 100 != 2:
18- print 'User creation failed: %s %s' % (resp.status, resp.reason)
19+ exit('User creation failed: %s %s' % (resp.status, resp.reason))
20
21=== modified file 'bin/swauth-cleanup-tokens'
22--- bin/swauth-cleanup-tokens 2011-04-12 19:17:48 +0000
23+++ bin/swauth-cleanup-tokens 2011-04-18 16:12:34 +0000
24@@ -69,13 +69,11 @@
25 objs = conn.get_container(container, marker=marker)[1]
26 except ClientException, e:
27 if e.http_status == 404:
28- print 'Container %s not found' % (container)
29- print 'swauth-prep needs to be rerun'
30- exit()
31+ exit('Container %s not found. swauth-prep needs to be '
32+ 'rerun' % (container))
33 else:
34- print 'Object listing on container %s failed with ' \
35- 'status code %d' % (container, e.http_status)
36- break
37+ exit('Object listing on container %s failed with status '
38+ 'code %d' % (container, e.http_status))
39 if objs:
40 marker = objs[-1]['name']
41 else:
42
43=== modified file 'bin/swauth-delete-account'
44--- bin/swauth-delete-account 2011-03-24 22:51:44 +0000
45+++ bin/swauth-delete-account 2011-04-18 16:12:34 +0000
46@@ -57,4 +57,4 @@
47 ssl=(parsed.scheme == 'https'))
48 resp = conn.getresponse()
49 if resp.status // 100 != 2:
50- print 'Account deletion failed: %s %s' % (resp.status, resp.reason)
51+ exit('Account deletion failed: %s %s' % (resp.status, resp.reason))
52
53=== modified file 'bin/swauth-delete-user'
54--- bin/swauth-delete-user 2011-03-24 22:51:44 +0000
55+++ bin/swauth-delete-user 2011-04-18 16:12:34 +0000
56@@ -57,4 +57,4 @@
57 ssl=(parsed.scheme == 'https'))
58 resp = conn.getresponse()
59 if resp.status // 100 != 2:
60- print 'User deletion failed: %s %s' % (resp.status, resp.reason)
61+ exit('User deletion failed: %s %s' % (resp.status, resp.reason))
62
63=== modified file 'bin/swauth-list'
64--- bin/swauth-list 2011-03-24 22:51:44 +0000
65+++ bin/swauth-list 2011-04-18 16:12:34 +0000
66@@ -75,9 +75,9 @@
67 conn = http_connect(parsed.hostname, parsed.port, 'GET', path, headers,
68 ssl=(parsed.scheme == 'https'))
69 resp = conn.getresponse()
70+ body = resp.read()
71 if resp.status // 100 != 2:
72- print 'List failed: %s %s' % (resp.status, resp.reason)
73- body = resp.read()
74+ exit('List failed: %s %s' % (resp.status, resp.reason))
75 if options.plain_text:
76 info = json.loads(body)
77 for group in info[['accounts', 'users', 'groups'][len(args)]]:
78
79=== modified file 'bin/swauth-prep'
80--- bin/swauth-prep 2011-03-24 22:51:44 +0000
81+++ bin/swauth-prep 2011-04-18 16:12:34 +0000
82@@ -56,4 +56,4 @@
83 ssl=(parsed.scheme == 'https'))
84 resp = conn.getresponse()
85 if resp.status // 100 != 2:
86- print 'Auth subsystem prep failed: %s %s' % (resp.status, resp.reason)
87+ exit('Auth subsystem prep failed: %s %s' % (resp.status, resp.reason))
88
89=== modified file 'bin/swauth-set-account-service'
90--- bin/swauth-set-account-service 2011-03-24 22:51:44 +0000
91+++ bin/swauth-set-account-service 2011-04-18 16:12:34 +0000
92@@ -70,4 +70,4 @@
93 conn.send(body)
94 resp = conn.getresponse()
95 if resp.status // 100 != 2:
96- print 'Service set failed: %s %s' % (resp.status, resp.reason)
97+ exit('Service set failed: %s %s' % (resp.status, resp.reason))