diff options
Diffstat (limited to 'openstackclient/compute/v2/server.py')
| -rw-r--r-- | openstackclient/compute/v2/server.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index b5c420fe..5cc73284 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -689,8 +689,8 @@ class CreateServer(command.ShowOne): parser.add_argument( '--hint', metavar='<key=value>', - action='append', - default=[], + action=parseractions.KeyValueAppendAction, + default={}, help=_('Hints for the scheduler (optional extension)'), ) parser.add_argument( @@ -986,16 +986,12 @@ class CreateServer(command.ShowOne): security_group_names.append(sg['name']) hints = {} - for hint in parsed_args.hint: - key, _sep, value = hint.partition('=') - # NOTE(vish): multiple copies of the same hint will - # result in a list of values - if key in hints: - if isinstance(hints[key], six.string_types): - hints[key] = [hints[key]] - hints[key] += [value] + for key, values in parsed_args.hint.items(): + # only items with multiple values will result in a list + if len(values) == 1: + hints[key] = values[0] else: - hints[key] = value + hints[key] = values # What does a non-boolean value for config-drive do? # --config-drive argument is either a volume id or |
