Fix providing port id when creating PT

We do not allow providing the port name, only the port-id.

The current logic to obtain the port-id from port-name
was causing this to break and is being removed.

Translation from port-name to port-id will require
making a call on the neutron client which is currently
not supported.

Change-Id: Iad5fc245aabf3d076a27890ee7155607e1c1ecfb
Closes-bug: 1392158
This commit is contained in:
Sumit Naiksatam 2014-12-16 12:36:08 -08:00
parent 2d83b68c2f
commit f264be8652

@ -61,9 +61,9 @@ class CreatePolicyTarget(neutronV20.CreateCommand):
default='',
help=_('Policy Target Group uuid'))
parser.add_argument(
'--port',
'--port-id',
default='',
help=_('Neutron Port'))
help=_('Neutron Port UUID'))
parser.add_argument(
'name', metavar='NAME',
help=_('Name of policy target to create'))
@ -78,11 +78,11 @@ class CreatePolicyTarget(neutronV20.CreateCommand):
neutronV20.find_resourceid_by_name_or_id(
self.get_client(), 'policy_target_group',
parsed_args.policy_target_group)
if parsed_args.port:
body[self.resource]['port_id'] = \
neutronV20.find_resourceid_by_name_or_id(
self.get_client(), 'port',
parsed_args.port)
if parsed_args.port_id:
body[self.resource]['port_id'] = (
parsed_args.port_id)
return body