diff options
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 56f9cd17..06542887 100644 --- a/openstackclient/common/utils.py +++ b/openstackclient/common/utils.py @@ -24,20 +24,27 @@ from openstackclient.common import exceptions def find_resource(manager, name_or_id): """Helper for the _find_* methods.""" - # first try to get entity as integer id + + # Try to get entity as integer id try: if isinstance(name_or_id, int) or name_or_id.isdigit(): return manager.get(int(name_or_id)) except exceptions.NotFound: pass - # now try to get entity as uuid + # Try to get entity as uuid try: uuid.UUID(str(name_or_id)) return manager.get(name_or_id) except (ValueError, exceptions.NotFound): pass + # Try directly using the passed value + try: + return manager.get(name_or_id) + except Exception: + pass + kwargs = {} if 'NAME_ATTR' in manager.resource_class.__dict__: # novaclient does this for oddball resources |
