diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-07-05 17:10:22 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-07-05 17:10:22 +0000 |
| commit | bf3ee1e9a5e7af4975571b2040659071ec08dcd7 (patch) | |
| tree | 0fc2f99b76a10ca9437323206bf110eb5213490f /openstackclient/common/utils.py | |
| parent | a54b88fa9fd6b6b857ed5f62d91b61677a34429c (diff) | |
| parent | f29a849ffcc203e7038fd2a026e0f755dcf2c1fc (diff) | |
| download | python-openstackclient-bf3ee1e9a5e7af4975571b2040659071ec08dcd7.tar.gz | |
Merge "Finish up v3 role commands"
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 |
