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

Proposed by Greg Lange
Status: Merged
Approved by: David Goetz
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 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
=== modified file 'bin/swauth-add-account'
--- bin/swauth-add-account 2011-03-24 22:51:44 +0000
+++ bin/swauth-add-account 2011-04-18 16:12:34 +0000
@@ -65,4 +65,4 @@
65 ssl=(parsed.scheme == 'https'))65 ssl=(parsed.scheme == 'https'))
66 resp = conn.getresponse()66 resp = conn.getresponse()
67 if resp.status // 100 != 2:67 if resp.status // 100 != 2:
68 print 'Account creation failed: %s %s' % (resp.status, resp.reason)68 exit('Account creation failed: %s %s' % (resp.status, resp.reason))
6969
=== modified file 'bin/swauth-add-user'
--- bin/swauth-add-user 2011-03-24 22:51:44 +0000
+++ bin/swauth-add-user 2011-04-18 16:12:34 +0000
@@ -90,4 +90,4 @@
90 ssl=(parsed.scheme == 'https'))90 ssl=(parsed.scheme == 'https'))
91 resp = conn.getresponse()91 resp = conn.getresponse()
92 if resp.status // 100 != 2:92 if resp.status // 100 != 2:
93 print 'User creation failed: %s %s' % (resp.status, resp.reason)93 exit('User creation failed: %s %s' % (resp.status, resp.reason))
9494
=== modified file 'bin/swauth-cleanup-tokens'
--- bin/swauth-cleanup-tokens 2011-04-12 19:17:48 +0000
+++ bin/swauth-cleanup-tokens 2011-04-18 16:12:34 +0000
@@ -69,13 +69,11 @@
69 objs = conn.get_container(container, marker=marker)[1]69 objs = conn.get_container(container, marker=marker)[1]
70 except ClientException, e:70 except ClientException, e:
71 if e.http_status == 404:71 if e.http_status == 404:
72 print 'Container %s not found' % (container)72 exit('Container %s not found. swauth-prep needs to be '
73 print 'swauth-prep needs to be rerun'73 'rerun' % (container))
74 exit()
75 else:74 else:
76 print 'Object listing on container %s failed with ' \75 exit('Object listing on container %s failed with status '
77 'status code %d' % (container, e.http_status)76 'code %d' % (container, e.http_status))
78 break
79 if objs:77 if objs:
80 marker = objs[-1]['name']78 marker = objs[-1]['name']
81 else:79 else:
8280
=== modified file 'bin/swauth-delete-account'
--- bin/swauth-delete-account 2011-03-24 22:51:44 +0000
+++ bin/swauth-delete-account 2011-04-18 16:12:34 +0000
@@ -57,4 +57,4 @@
57 ssl=(parsed.scheme == 'https'))57 ssl=(parsed.scheme == 'https'))
58 resp = conn.getresponse()58 resp = conn.getresponse()
59 if resp.status // 100 != 2:59 if resp.status // 100 != 2:
60 print 'Account deletion failed: %s %s' % (resp.status, resp.reason)60 exit('Account deletion failed: %s %s' % (resp.status, resp.reason))
6161
=== modified file 'bin/swauth-delete-user'
--- bin/swauth-delete-user 2011-03-24 22:51:44 +0000
+++ bin/swauth-delete-user 2011-04-18 16:12:34 +0000
@@ -57,4 +57,4 @@
57 ssl=(parsed.scheme == 'https'))57 ssl=(parsed.scheme == 'https'))
58 resp = conn.getresponse()58 resp = conn.getresponse()
59 if resp.status // 100 != 2:59 if resp.status // 100 != 2:
60 print 'User deletion failed: %s %s' % (resp.status, resp.reason)60 exit('User deletion failed: %s %s' % (resp.status, resp.reason))
6161
=== modified file 'bin/swauth-list'
--- bin/swauth-list 2011-03-24 22:51:44 +0000
+++ bin/swauth-list 2011-04-18 16:12:34 +0000
@@ -75,9 +75,9 @@
75 conn = http_connect(parsed.hostname, parsed.port, 'GET', path, headers,75 conn = http_connect(parsed.hostname, parsed.port, 'GET', path, headers,
76 ssl=(parsed.scheme == 'https'))76 ssl=(parsed.scheme == 'https'))
77 resp = conn.getresponse()77 resp = conn.getresponse()
78 body = resp.read()
78 if resp.status // 100 != 2:79 if resp.status // 100 != 2:
79 print 'List failed: %s %s' % (resp.status, resp.reason)80 exit('List failed: %s %s' % (resp.status, resp.reason))
80 body = resp.read()
81 if options.plain_text:81 if options.plain_text:
82 info = json.loads(body)82 info = json.loads(body)
83 for group in info[['accounts', 'users', 'groups'][len(args)]]:83 for group in info[['accounts', 'users', 'groups'][len(args)]]:
8484
=== modified file 'bin/swauth-prep'
--- bin/swauth-prep 2011-03-24 22:51:44 +0000
+++ bin/swauth-prep 2011-04-18 16:12:34 +0000
@@ -56,4 +56,4 @@
56 ssl=(parsed.scheme == 'https'))56 ssl=(parsed.scheme == 'https'))
57 resp = conn.getresponse()57 resp = conn.getresponse()
58 if resp.status // 100 != 2:58 if resp.status // 100 != 2:
59 print 'Auth subsystem prep failed: %s %s' % (resp.status, resp.reason)59 exit('Auth subsystem prep failed: %s %s' % (resp.status, resp.reason))
6060
=== modified file 'bin/swauth-set-account-service'
--- bin/swauth-set-account-service 2011-03-24 22:51:44 +0000
+++ bin/swauth-set-account-service 2011-04-18 16:12:34 +0000
@@ -70,4 +70,4 @@
70 conn.send(body)70 conn.send(body)
71 resp = conn.getresponse()71 resp = conn.getresponse()
72 if resp.status // 100 != 2:72 if resp.status // 100 != 2:
73 print 'Service set failed: %s %s' % (resp.status, resp.reason)73 exit('Service set failed: %s %s' % (resp.status, resp.reason))