diff options
| author | Steve Martinelli <stevemar@ca.ibm.com> | 2013-04-18 17:49:42 -0500 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2013-07-03 11:51:23 -0500 |
| commit | f29a849ffcc203e7038fd2a026e0f755dcf2c1fc (patch) | |
| tree | 75ff2e2a5d529d7b81236bbf1100393a0e173f5a /openstackclient/common | |
| parent | d50b5750640ace3a77e6e0637d6cd24f91db8080 (diff) | |
| download | python-openstackclient-f29a849ffcc203e7038fd2a026e0f755dcf2c1fc.tar.gz | |
Finish up v3 role commands
* Add remove role
* Add --role to group list
* Add --role to user list
* Fix groups in AddRole()
* Remove the tweaks to utils.find_resource for domains; will address
that across domains, projects, users and groups in another patch.
I want to nail down the structure of these commands and get that into place
Change-Id: I8673dd8221ef88978dada5a2833c187026bdb31a
Diffstat (limited to 'openstackclient/common')
| -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 |
