From f264be8652c3f1c92254bcc631b66cb1c852b714 Mon Sep 17 00:00:00 2001 From: Sumit Naiksatam Date: Tue, 16 Dec 2014 12:36:08 -0800 Subject: [PATCH] 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 --- gbpclient/gbp/v2_0/groupbasedpolicy.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gbpclient/gbp/v2_0/groupbasedpolicy.py b/gbpclient/gbp/v2_0/groupbasedpolicy.py index 1a83c9d..8312269 100644 --- a/gbpclient/gbp/v2_0/groupbasedpolicy.py +++ b/gbpclient/gbp/v2_0/groupbasedpolicy.py @@ -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