summaryrefslogtreecommitdiff
path: root/novaclient/v2
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2019-09-25 12:10:21 +0100
committerStephen Finucane <sfinucan@redhat.com>2019-10-01 15:59:17 +0100
commitc7e793c22e72d4d426a6d10e9c2cfa426fedd365 (patch)
treefc09c981a174931727b78ad8ff1a894b5ff1e853 /novaclient/v2
parente15cc789d9428cd03c2c5fbd6f5023522f2290cc (diff)
downloadpython-novaclient-stable/stein.tar.gz
Stop silently ignoring invalid 'nova boot --hint' optionsstein-eolstein-em13.0.2stable/stein
The '--hint' option for 'nova boot' expects a key-value pair like so: nova boot --hint group=245e1dfe-2d0e-4139-80a9-fce124948896 ... However, the command doesn't complain if this isn't the case, meaning typos like the below aren't indicated to the user: nova boot --hint 245e1dfe-2d0e-4139-80a9-fce124948896 Due to how we'd implemented this here, this ultimately results in us POSTing the following as part of the body to 'os-servers': { ... "OS-SCH-HNT:scheduler_hints": { "245e1dfe-2d0e-4139-80a9-fce124948896": null } ... } Which is unfortunately allowed and ignored by nova due to the use of 'additionalProperties' in the schema [1] Do what we do for loads of other options and explicitly fail on invalid values. NOTE(stephenfin): This includes the release note first added separately in change I753e9a0cda1e118578373c519cf2fb2dd605a623. [1] https://github.com/openstack/nova/blob/19.0.0/nova/api/openstack/compute/schemas/servers.py#L142-L146 Change-Id: I0f9f75cba68e7582d32d4aab2f8f077b4360d386 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Closes-Bug: #1845322 (cherry picked from commit 6954aacd54e85859fecde22ac04db1ce7601dd35) (cherry picked from commit 33627242e8f845934bcc5affb616108a79d28cbe)
Diffstat (limited to 'novaclient/v2')
-rw-r--r--novaclient/v2/shell.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py
index c5f4d916..3cc44478 100644
--- a/novaclient/v2/shell.py
+++ b/novaclient/v2/shell.py
@@ -474,8 +474,7 @@ def _boot(cs, args):
hints = {}
if args.scheduler_hints:
- for hint in args.scheduler_hints:
- key, _sep, value = hint.partition('=')
+ for key, value in args.scheduler_hints:
# NOTE(vish): multiple copies of the same hint will
# result in a list of values
if key in hints:
@@ -789,6 +788,7 @@ def _boot(cs, args):
'--hint',
action='append',
dest='scheduler_hints',
+ type=_key_value_pairing,
default=[],
metavar='<key=value>',
help=_("Send arbitrary key/value pairs to the scheduler for custom "