summaryrefslogtreecommitdiff
path: root/openstackclient/network/v2/floating_ip.py
diff options
context:
space:
mode:
authoryanpuqing <yanpq@awcloud.com>2018-06-13 05:21:53 -0400
committeryanpuqing <yanpq@awcloud.com>2018-06-13 23:05:30 -0400
commit402c9a21b347509520be206e28ee7d0ef4004b92 (patch)
treeb517f5c35ed85ec8761dcfcebe82414c94592cf4 /openstackclient/network/v2/floating_ip.py
parentf7e4d31820e797e0d374e7dfde1142373245ea87 (diff)
downloadpython-openstackclient-402c9a21b347509520be206e28ee7d0ef4004b92.tar.gz
Do not require port argument when updating floating IP
When setting floating ip other properties, port argument is force to use. The patch modifies the command, when setting floating ip other properties, like tags, no need port argument. Change-Id: I908712c8913f32d3dd5fdfefe7347277d72f66de Story: 1751431 Task: 13865
Diffstat (limited to 'openstackclient/network/v2/floating_ip.py')
-rw-r--r--openstackclient/network/v2/floating_ip.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/openstackclient/network/v2/floating_ip.py b/openstackclient/network/v2/floating_ip.py
index f51baed5..2f0e7403 100644
--- a/openstackclient/network/v2/floating_ip.py
+++ b/openstackclient/network/v2/floating_ip.py
@@ -416,11 +416,10 @@ class SetFloatingIP(command.Command):
parser.add_argument(
'floating_ip',
metavar='<floating-ip>',
- help=_("Floating IP to associate (IP address or ID)"))
+ help=_("Floating IP to modify (IP address or ID)"))
parser.add_argument(
'--port',
metavar='<port>',
- required=True,
help=_("Associate the floating IP with port (name or ID)")),
parser.add_argument(
'--fixed-ip-address',
@@ -452,9 +451,11 @@ class SetFloatingIP(command.Command):
parsed_args.floating_ip,
ignore_missing=False,
)
- port = client.find_port(parsed_args.port,
- ignore_missing=False)
- attrs['port_id'] = port.id
+ if parsed_args.port:
+ port = client.find_port(parsed_args.port,
+ ignore_missing=False)
+ attrs['port_id'] = port.id
+
if parsed_args.fixed_ip_address:
attrs['fixed_ip_address'] = parsed_args.fixed_ip_address