Skip to content

Commit 48bb39f

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "utils.find_resource does not catch right exception"
2 parents 1212ddb + 7029cf3 commit 48bb39f

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎openstackclient/common/utils.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,15 @@ def find_resource(manager, name_or_id):
3333
try:
3434
if isinstance(name_or_id, int) or name_or_id.isdigit():
3535
return manager.get(int(name_or_id))
36-
except exceptions.NotFound:
37-
pass
36+
# FIXME(dtroyer): The exception to catch here is dependent on which
37+
# client library the manager passed in belongs to.
38+
# Eventually this should be pulled from a common set
39+
# of client exceptions.
40+
except Exception as ex:
41+
if type(ex).__name__ == 'NotFound':
42+
pass
43+
else:
44+
raise
3845

3946
# Try directly using the passed value
4047
try:

0 commit comments

Comments
 (0)