2016-03-03 16:07:00 |
Goutham Pacha Ravi |
description |
Single alias action does not support non None default values |
If aliases are used for CLI options, setting 'action=single_alias' is a way to force the CLI user to only use one alias of a particular option. However, when the default value of the option is not None, this method is broken. For example:
@cliutils.arg(
'share',
metavar='<share>',
help='Name or ID of the share to modify.')
@cliutils.arg(
'--task-state',
'--task_state',
'--state',
metavar='<task_state>',
action='single_alias',
default='migration_error',
help=('Indicate which task state to assign the share. Options include '
'migration_starting, migration_in_progress, migration_completing, '
'migration_success, migration_error, migration_cancelled, '
'migration_driver_in_progress, migration_driver_phase1_done, '
'data_copying_starting, data_copying_in_progress, '
'data_copying_completing, data_copying_completed, '
'data_copying_cancelled, data_copying_error. If no value is '
'provided, migration_error will be used.'))
@api_versions.experimental_api
@api_versions.wraps("2.15")
def do_reset_task_state(cs, args):
"""Explicitly update the task state of a share (Experimental)."""
share = _find_share(cs, args.share)
share.reset_task_state(args.task_state)
Execute:
manila reset-task-state share_1 --task-state llama
error: argument --task-state/--task_state/--state: Only one alias is allowed at a time.
There are some aliases being allowed multiple times at this point as a workaround to this bug. |
|