Do not write except:, use except Exception instead

Follow the hacking: http://docs.openstack.org/developer/hacking.
Do not write except:, use except Exception: at the very least.
When catching an exception you should be as specific so you
don’t mistakenly catch unexpected exceptions.This patch is to
fix it.

Change-Id: Iefdc52e7ad87a51b79ac1fa1175f7b62e6d8eb4f
Closes-Bug: #1600714
This commit is contained in:
weiweigu
2016-07-11 20:06:46 +08:00
parent b128a4d2e1
commit b99ed02551
2 changed files with 2 additions and 2 deletions

View File

@@ -39,7 +39,7 @@ def validate_ref(ref, entity):
try:
_, entity_uuid = ref.rstrip('/').rsplit('/', 1)
uuid.UUID(entity_uuid)
except:
except Exception:
raise ValueError('{0} incorrectly specified.'.format(entity))
return True

View File

@@ -236,7 +236,7 @@ class KeystoneClientFixture(testtools.TestCase):
try:
self.barbican.run(argv=argv)
except:
except Exception:
self.fail('failed to delete secret')
def test_v2_auth(self):