From b99ed02551b5f02ccfd7fccf96a5062f7a500815 Mon Sep 17 00:00:00 2001 From: weiweigu Date: Mon, 11 Jul 2016 20:06:46 +0800 Subject: [PATCH] Do not write except:, use except Exception instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- barbicanclient/base.py | 2 +- barbicanclient/tests/keystone_client_fixtures.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/barbicanclient/base.py b/barbicanclient/base.py index 168ece12..738526bb 100644 --- a/barbicanclient/base.py +++ b/barbicanclient/base.py @@ -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 diff --git a/barbicanclient/tests/keystone_client_fixtures.py b/barbicanclient/tests/keystone_client_fixtures.py index eb3de381..202bedd0 100644 --- a/barbicanclient/tests/keystone_client_fixtures.py +++ b/barbicanclient/tests/keystone_client_fixtures.py @@ -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):