diff --git a/bin/trove-cli b/bin/trove-cli index fc30e03d4f..11eb8c1c42 100755 --- a/bin/trove-cli +++ b/bin/trove-cli @@ -60,7 +60,7 @@ class InstanceCommands(object): try: result = dbaas.instances.create(name, flavorRef, volume) _pretty_print(result._info) - except: + except Exception: print sys.exc_info()[1] def delete(self, id): @@ -70,7 +70,7 @@ class InstanceCommands(object): result = dbaas.instances.delete(id) if result: print result - except: + except Exception: print sys.exc_info()[1] def get(self, id): @@ -78,7 +78,7 @@ class InstanceCommands(object): dbaas = common.get_client() try: _pretty_print(dbaas.instances.get(id)._info) - except: + except Exception: print sys.exc_info()[1] def list(self): @@ -87,7 +87,7 @@ class InstanceCommands(object): try: for instance in dbaas.instances.list(): _pretty_print(instance._info) - except: + except Exception: print sys.exc_info()[1] def resize(self, id, size): @@ -97,7 +97,7 @@ class InstanceCommands(object): result = dbaas.instances.resize(id, size) if result: print result - except: + except Exception: print sys.exc_info()[1] def restart(self, id): @@ -107,7 +107,7 @@ class InstanceCommands(object): result = dbaas.instances.restart(id) if result: print result - except: + except Exception: print sys.exc_info()[1] @@ -123,7 +123,7 @@ class FlavorsCommands(object): try: for flavor in dbaas.flavors.list(): _pretty_print(flavor._info) - except: + except Exception: print sys.exc_info()[1] @@ -139,7 +139,7 @@ class DatabaseCommands(object): try: databases = [{'name': dbname}] dbaas.databases.create(id, databases) - except: + except Exception: print sys.exc_info()[1] def delete(self, id, dbname): @@ -147,7 +147,7 @@ class DatabaseCommands(object): dbaas = common.get_client() try: dbaas.databases.delete(id, dbname) - except: + except Exception: print sys.exc_info()[1] def list(self, id): @@ -156,7 +156,7 @@ class DatabaseCommands(object): try: for database in dbaas.databases.list(id): _pretty_print(database._info) - except: + except Exception: print sys.exc_info()[1] @@ -175,7 +175,7 @@ class UserCommands(object): users = [{'name': username, 'password': password, 'databases': databases}] dbaas.users.create(id, users) - except: + except Exception: print sys.exc_info()[1] def delete(self, id, user): @@ -183,7 +183,7 @@ class UserCommands(object): dbaas = common.get_client() try: dbaas.users.delete(id, user) - except: + except Exception: print sys.exc_info()[1] def list(self, id): @@ -192,7 +192,7 @@ class UserCommands(object): try: for user in dbaas.users.list(id): _pretty_print(user._info) - except: + except Exception: print sys.exc_info()[1] @@ -208,7 +208,7 @@ class RootCommands(object): try: user, password = dbaas.root.create(id) print "User:\t\t%s\nPassword:\t%s" % (user, password) - except: + except Exception: print sys.exc_info()[1] def enabled(self, id): @@ -216,7 +216,7 @@ class RootCommands(object): dbaas = common.get_client() try: _pretty_print(dbaas.root.is_root_enabled(id)) - except: + except Exception: print sys.exc_info()[1] @@ -233,7 +233,7 @@ class VersionCommands(object): versions = dbaas.versions.index(url) for version in versions: _pretty_print(version._info) - except: + except Exception: print sys.exc_info()[1] diff --git a/tox.ini b/tox.ini index bd8d76fdfe..79ddc85577 100644 --- a/tox.ini +++ b/tox.ini @@ -33,7 +33,7 @@ commands = {posargs} [flake8] show-source = True -ignore = E125,F401,F403,F811,F821,F841,H102,H103,H201,H233,H301,H306,H401,H402,H403,H404 +ignore = E125,F401,F403,F811,F821,F841,H23,H301,H306,H401,H402,H403,H404,H702,H703 builtins = _ -exclude=.venv,.tox,dist,doc,openstack,*egg,rsdns,tools,etc -filename=*.py,trove-* +exclude=.venv,.tox,dist,doc,openstack,*egg,rsdns,tools,etc,build +filename=*.py,trove-* \ No newline at end of file diff --git a/trove/common/auth.py b/trove/common/auth.py index 55c253293c..e7afdf0a0a 100644 --- a/trove/common/auth.py +++ b/trove/common/auth.py @@ -81,7 +81,7 @@ def admin_context(f): try: req = args[1] context = req.environ.get('trove.context') - except: + except Exception: raise exception.TroveError("Cannot load request context.") if not context.is_admin: raise exception.Forbidden("User does not have admin privileges.") diff --git a/trove/guestagent/manager/mysql_service.py b/trove/guestagent/manager/mysql_service.py index 14af9c56e8..7bcbf6392f 100644 --- a/trove/guestagent/manager/mysql_service.py +++ b/trove/guestagent/manager/mysql_service.py @@ -273,7 +273,7 @@ class LocalSqlClient(object): def execute(self, t, **kwargs): try: return self.conn.execute(t, kwargs) - except: + except Exception: self.trans.rollback() self.trans = None raise diff --git a/trove/quota/quota.py b/trove/quota/quota.py index 948bfb3103..27c995aebf 100644 --- a/trove/quota/quota.py +++ b/trove/quota/quota.py @@ -326,7 +326,7 @@ def run_with_quotas(tenant_id, deltas, f): result = None try: result = f() - except: + except Exception: QUOTAS.rollback(reservations) raise else: diff --git a/trove/tests/util/__init__.py b/trove/tests/util/__init__.py index 5128d88094..055aa2a8f6 100644 --- a/trove/tests/util/__init__.py +++ b/trove/tests/util/__init__.py @@ -303,7 +303,7 @@ class LocalSqlClient(object): def execute(self, t, **kwargs): try: return self.conn.execute(t, kwargs) - except: + except Exception: self.trans.rollback() self.trans = None raise diff --git a/trove/tests/util/mysql.py b/trove/tests/util/mysql.py index 46920e8984..b03e43dc97 100644 --- a/trove/tests/util/mysql.py +++ b/trove/tests/util/mysql.py @@ -76,7 +76,7 @@ class SqlAlchemyConnection(object): cmd = cmd.replace("%", "%%") try: return self.conn.execute(cmd).fetchall() - except: + except Exception: self.trans.rollback() self.trans = None try: