diff options
| author | Jenkins <jenkins@review.openstack.org> | 2014-09-28 07:39:19 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2014-09-28 07:39:19 +0000 |
| commit | 48bb39f29999dced24488d61cc3e4656ac652577 (patch) | |
| tree | dd4d07b7a57b98192e81ecd9e567f403b0115775 /openstackclient/common/utils.py | |
| parent | 1212ddb431c8ecdebbc89dc54a5854ac7794ace5 (diff) | |
| parent | 7029cf37e268a789a65bab3b9a16e4491854106e (diff) | |
| download | python-openstackclient-48bb39f29999dced24488d61cc3e4656ac652577.tar.gz | |
Merge "utils.find_resource does not catch right exception"
Diffstat (limited to 'openstackclient/common/utils.py')
| -rw-r--r-- | openstackclient/common/utils.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/openstackclient/common/utils.py b/openstackclient/common/utils.py index 5c5466df..818f8d47 100644 --- a/openstackclient/common/utils.py +++ b/openstackclient/common/utils.py @@ -33,8 +33,15 @@ def find_resource(manager, name_or_id): try: if isinstance(name_or_id, int) or name_or_id.isdigit(): return manager.get(int(name_or_id)) - except exceptions.NotFound: - pass + # FIXME(dtroyer): The exception to catch here is dependent on which + # client library the manager passed in belongs to. + # Eventually this should be pulled from a common set + # of client exceptions. + except Exception as ex: + if type(ex).__name__ == 'NotFound': + pass + else: + raise # Try directly using the passed value try: |
