summaryrefslogtreecommitdiff
path: root/openstackclient/compute
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2022-10-26 18:17:38 +0300
committerStephen Finucane <sfinucan@redhat.com>2022-11-08 11:25:19 +0000
commited0d568b948a04e893270d297c538773d058b73e (patch)
treeb0f0da703c6baceb0699ce555f4f055d3420cfb3 /openstackclient/compute
parent681934a96aa8e35ae3babc89bfb2b56d2daea950 (diff)
downloadpython-openstackclient-ed0d568b948a04e893270d297c538773d058b73e.tar.gz
compute: Fix '--network none/auto' handling
This should lookup a network called 'none' or 'auto', not do the equivalent on '--nic none' or '--nic auto'. Correct this. Change-Id: I3c5acc49bfe8162d8fb6110603da56d56090b78f Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Story: 2010385 Task: 46658
Diffstat (limited to 'openstackclient/compute')
-rw-r--r--openstackclient/compute/v2/server.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index 39b2bdc8..1d072463 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -721,11 +721,6 @@ class NICAction(argparse.Action):
if getattr(namespace, self.dest, None) is None:
setattr(namespace, self.dest, [])
- # Handle the special auto/none cases
- if values in ('auto', 'none'):
- getattr(namespace, self.dest).append(values)
- return
-
if self.key:
if ',' in values or '=' in values:
msg = _(
@@ -735,6 +730,12 @@ class NICAction(argparse.Action):
raise argparse.ArgumentTypeError(msg % values)
values = '='.join([self.key, values])
+ else:
+ # Handle the special auto/none cases but only when a key isn't set
+ # (otherwise those could be valid values for the key)
+ if values in ('auto', 'none'):
+ getattr(namespace, self.dest).append(values)
+ return
# We don't include 'tag' here by default since that requires a
# particular microversion