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