openstack-python-openstackc.../openstackclient
Stephen Finucane ea27ebb0f9 Stop silently ignoring invalid 'server create --hint' options
The '--hint' option for 'server create' expects a key-value pair like so:

  openstack server create --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:

  openstack server create --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. This involves adding a new argparse action since none of those
defined in osc-lib work for us. This is included here to ease
backporting of the fix but will be moved to osc-lib in a future patch.

[1] https://github.com/openstack/nova/blob/19.0.0/nova/api/openstack/compute/schemas/servers.py#L142-L146

Change-Id: I9e96d2978912c8dfeadae4a782c481a17cd7e348
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Story: #2006628
Task: #36840
Related-Bug: #1845322
2020-02-03 15:25:24 +00:00
..
api Raise flake8-import-order version to latest 2020-01-10 14:21:47 -06:00
common Merge "Show correct name for resource with quota set to zero" 2020-01-14 05:00:00 +00:00
compute Stop silently ignoring invalid 'server create --hint' options 2020-02-03 15:25:24 +00:00
identity Add support for app cred access rules 2020-01-17 11:14:51 -08:00
image Replace six.iteritems() with .items() 2020-01-09 18:41:29 +09:00
locale/tr_TR/LC_MESSAGES Imported Translations from Zanata 2018-03-01 07:25:50 +00:00
network Switch to using osc_lib.utils.tags 2020-01-14 17:10:41 -08:00
object Replace six.iteritems() with .items() 2020-01-09 18:41:29 +09:00
tests Stop silently ignoring invalid 'server create --hint' options 2020-02-03 15:25:24 +00:00
volume Replace six.iteritems() with .items() 2020-01-09 18:41:29 +09:00
__init__.py Clean up W503 and E402 pep8 errors 2018-04-15 12:23:06 +09:00
i18n.py Remove log translations 2017-03-21 17:23:09 +08:00
shell.py Remove redundant OpenStackShell.prepare_to_run_command 2019-10-31 16:53:30 +00:00