summaryrefslogtreecommitdiff
path: root/openstackclient/common
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-04-25 19:23:16 +0000
committerGerrit Code Review <review@openstack.org>2013-04-25 19:23:16 +0000
commite273691c674292a6b7eaa15a3cf754833ab840ee (patch)
treec932b062631a638fc51cf01a6cae87b4327f7585 /openstackclient/common
parentc5e9048dc43e31b183ae8b1052dedf0d474d924d (diff)
parente9021c213b0f98195920e63aa573c040d5a3cf6d (diff)
downloadpython-openstackclient-e273691c674292a6b7eaa15a3cf754833ab840ee.tar.gz
Merge "Add fixed-ip and floating-ip commands"
Diffstat (limited to 'openstackclient/common')
-rw-r--r--openstackclient/common/utils.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/openstackclient/common/utils.py b/openstackclient/common/utils.py
index 76532fcb..8a792675 100644
--- a/openstackclient/common/utils.py
+++ b/openstackclient/common/utils.py
@@ -38,9 +38,16 @@ def find_resource(manager, name_or_id):
except (ValueError, exceptions.NotFound):
pass
+ kwargs = {}
+ if 'NAME_ATTR' in manager.resource_class.__dict__:
+ # novaclient does this for oddball resources
+ kwargs[manager.resource_class.NAME_ATTR] = name_or_id
+ else:
+ kwargs['name'] = name_or_id
+
# finally try to find entity by name
try:
- return manager.find(name=name_or_id)
+ return manager.find(**kwargs)
# 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