Merge "HACKING compliance: consistent usage of 'except'"
This commit is contained in:
@@ -42,7 +42,7 @@ class ServiceCatalog(object):
|
|||||||
try:
|
try:
|
||||||
token['user_id'] = self.catalog['user']['id']
|
token['user_id'] = self.catalog['user']['id']
|
||||||
token['tenant_id'] = self.catalog['token']['tenant']['id']
|
token['tenant_id'] = self.catalog['token']['tenant']['id']
|
||||||
except:
|
except Exception:
|
||||||
# just leave the tenant and user out if it doesn't exist
|
# just leave the tenant and user out if it doesn't exist
|
||||||
pass
|
pass
|
||||||
return token
|
return token
|
||||||
|
@@ -406,7 +406,7 @@ def main():
|
|||||||
try:
|
try:
|
||||||
OpenStackIdentityShell().main(sys.argv[1:])
|
OpenStackIdentityShell().main(sys.argv[1:])
|
||||||
|
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
if httplib2.debuglevel == 1:
|
if httplib2.debuglevel == 1:
|
||||||
raise # dump stack.
|
raise # dump stack.
|
||||||
else:
|
else:
|
||||||
|
@@ -192,7 +192,7 @@ class Client(client.HTTPClient):
|
|||||||
except (exceptions.AuthorizationFailure, exceptions.Unauthorized):
|
except (exceptions.AuthorizationFailure, exceptions.Unauthorized):
|
||||||
_logger.debug("Authorization Failed.")
|
_logger.debug("Authorization Failed.")
|
||||||
raise
|
raise
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
raise exceptions.AuthorizationFailure("Authorization Failed: "
|
raise exceptions.AuthorizationFailure("Authorization Failed: "
|
||||||
"%s" % e)
|
"%s" % e)
|
||||||
|
|
||||||
|
@@ -96,7 +96,7 @@ def do_user_update(kc, args):
|
|||||||
try:
|
try:
|
||||||
kc.users.update(args.id, **kwargs)
|
kc.users.update(args.id, **kwargs)
|
||||||
print 'User has been updated.'
|
print 'User has been updated.'
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print 'Unable to update user: %s' % e
|
print 'Unable to update user: %s' % e
|
||||||
|
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ def do_ec2_credentials_list(kc, args):
|
|||||||
for cred in credentials:
|
for cred in credentials:
|
||||||
try:
|
try:
|
||||||
cred.tenant = getattr(kc.tenants.get(cred.tenant_id), 'name')
|
cred.tenant = getattr(kc.tenants.get(cred.tenant_id), 'name')
|
||||||
except:
|
except Exception:
|
||||||
# FIXME(dtroyer): Retrieving the tenant name fails for normal
|
# FIXME(dtroyer): Retrieving the tenant name fails for normal
|
||||||
# users; stuff in the tenant_id instead.
|
# users; stuff in the tenant_id instead.
|
||||||
cred.tenant = cred.tenant_id
|
cred.tenant = cred.tenant_id
|
||||||
@@ -340,7 +340,7 @@ def do_ec2_credentials_delete(kc, args):
|
|||||||
try:
|
try:
|
||||||
kc.ec2.delete(args.user_id, args.access)
|
kc.ec2.delete(args.user_id, args.access)
|
||||||
print 'Credential has been deleted.'
|
print 'Credential has been deleted.'
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print 'Unable to delete credential: %s' % e
|
print 'Unable to delete credential: %s' % e
|
||||||
|
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ def do_endpoint_delete(kc, args):
|
|||||||
try:
|
try:
|
||||||
kc.endpoints.delete(args.id)
|
kc.endpoints.delete(args.id)
|
||||||
print 'Endpoint has been deleted.'
|
print 'Endpoint has been deleted.'
|
||||||
except:
|
except Exception:
|
||||||
print 'Unable to delete endpoint.'
|
print 'Unable to delete endpoint.'
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user