Merge "Add fixed-ip and floating-ip commands"

This commit is contained in:
Jenkins 2013-04-25 19:23:16 +00:00 committed by Gerrit Code Review
commit 3e262fdf9f
2 changed files with 25 additions and 1 deletions

View File

@ -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

View File

@ -193,11 +193,28 @@ setuptools.setup(
'set_compute-service='
'openstackclient.compute.v2.service:SetService',
'add_fixed-ip=openstackclient.compute.v2.fixedip:AddFixedIP',
'remove_fixed-ip=openstackclient.compute.v2.fixedip:RemoveFixedIP',
'create_flavor=openstackclient.compute.v2.flavor:CreateFlavor',
'delete_flavor=openstackclient.compute.v2.flavor:DeleteFlavor',
'list_flavor=openstackclient.compute.v2.flavor:ListFlavor',
'show_flavor=openstackclient.compute.v2.flavor:ShowFlavor',
'add_floating-ip='
'openstackclient.compute.v2.floatingip:AddFloatingIP',
'create_floating-ip='
'openstackclient.compute.v2.floatingip:CreateFloatingIP',
'delete_floating-ip='
'openstackclient.compute.v2.floatingip:DeleteFloatingIP',
'list_floating-ip='
'openstackclient.compute.v2.floatingip:ListFloatingIP',
'remove_floating-ip='
'openstackclient.compute.v2.floatingip:RemoveFloatingIP',
'list_floating-ip-pool='
'openstackclient.compute.v2.floatingippool:ListFloatingIPPool',
'list_host=openstackclient.compute.v2.host:ListHost',
'show_host=openstackclient.compute.v2.host:ShowHost',