Single alias action does not support non None default values

Bug #1552771 reported by Goutham Pacha Ravi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-manilaclient
Fix Released
High
Valeriy Ponomaryov

Bug Description

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.

description: updated
Changed in python-manilaclient:
assignee: nobody → NidhiMittalHada (nidhimittal19)
Changed in python-manilaclient:
status: New → In Progress
Revision history for this message
NidhiMittalHada (nidhimittal19) wrote :

working on this

Changed in python-manilaclient:
importance: Undecided → High
assignee: NidhiMittalHada (nidhimittal19) → Valeriy Ponomaryov (vponomaryov)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-manilaclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/316111

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-manilaclient (master)

Reviewed: https://review.openstack.org/316111
Committed: https://git.openstack.org/cgit/openstack/python-manilaclient/commit/?id=ea5c3e7b28d5963ae9b64733f8e778ecd219b9a7
Submitter: Jenkins
Branch: master

commit ea5c3e7b28d5963ae9b64733f8e778ecd219b9a7
Author: Valeriy Ponomaryov <email address hidden>
Date: Fri May 13 16:54:20 2016 +0300

    Fix "single_alias" action for CLI commands

    For the moment if default value for CLI option with
    "single_alias" action is different than None we cannot redefine it.
    Fix it and cover with unit tests.

    Also, fix existing aliases and add some where good to have.

    Change-Id: Ic61426d9bd894b01f9b035d6d19bb7bd113f96ad
    Closes-Bug: #1552771

Changed in python-manilaclient:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-manilaclient 1.9.0

This issue was fixed in the openstack/python-manilaclient 1.9.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.