diff options
author | Prashanth Pai <ppai@redhat.com> | 2013-11-22 12:13:09 +0530 |
---|---|---|
committer | Luis Pabon <lpabon@redhat.com> | 2013-12-18 04:12:43 -0800 |
commit | a8c84cb2da77ab294edbdc113985125f9a8acb95 (patch) | |
tree | 5392e2a2e045034d118f6d164f1b4885b94614ee /gluster/swift/common/middleware/gswauth/bin/gswauth-delete-account | |
parent | b46b3dc7f292d8a082a2d86485b7d9aaa0f47b7f (diff) |
gswauth: Fix 403 being returned instead of 401
- 401(Unauthorized) is to be returned when user credentials are
wrong where as 403(Forbidden) is to be returned when user
credentials are correct but the user doesn't have the priveleges
to carry out the operation.
- Also error messages displayed when using swauth-* command line
utilities have been updated.
Change-Id: I485786896ad14d3263f4325d1857cacc93adab96
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Reviewed-on: http://review.gluster.org/6336
Reviewed-by: Luis Pabon <lpabon@redhat.com>
Tested-by: Luis Pabon <lpabon@redhat.com>
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Reviewed-on: http://review.gluster.org/6447
Reviewed-by: Thiago Da Silva <thiago@redhat.com>
Tested-by: Thiago Da Silva <thiago@redhat.com>
Diffstat (limited to 'gluster/swift/common/middleware/gswauth/bin/gswauth-delete-account')
-rwxr-xr-x | gluster/swift/common/middleware/gswauth/bin/gswauth-delete-account | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-account b/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-account index 854a5d4..be8ace8 100755 --- a/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-account +++ b/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-account @@ -57,4 +57,17 @@ if __name__ == '__main__': ssl=(parsed.scheme == 'https')) resp = conn.getresponse() if resp.status // 100 != 2: - exit('Account deletion failed: %s %s' % (resp.status, resp.reason)) + if resp.status == 401: + exit('Delete account failed: %s %s: Invalid user/key provided' % + (resp.status, resp.reason)) + elif resp.status == 403: + exit('Delete account failed: %s %s: Insufficient privileges' % + (resp.status, resp.reason)) + elif resp.status == 404: + exit('Delete account failed: %s %s: Account %s does not exist' % + (resp.status, resp.reason, account)) + elif resp.status == 409: + exit('Delete account failed: %s %s: Account %s contains active users. ' + 'Delete all users first.' % (resp.status, resp.reason, account)) + else: + exit('Delete account failed: %s %s' % (resp.status, resp.reason)) |