Positional arguments not handled correctly

Bug #1676989 reported by John Perkins on 2017-03-28
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stephen Finucane

Bug Description

Something is preventing positional=True from working correctly. When positional=True is set, the option is not set, regardless of where the argument ends up in the command. Please see [0] for more details.

[0] line 60: https://review.openstack.org/#/c/384559/49/oslo_config/validator.py

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

Changed in oslo.config:
assignee: nobody → Dolph Mathews (dolph)
status: New → In Progress
Dolph Mathews (dolph) wrote :

There's two issues with that one StrOpt that I've identified.

Firstly, marking it as both positional and required results in an argparse argument that is positional and optional.

Secondly, including a hyphen in the option name results in a hyphen in the destination variable name in the argument namespace (unlike other destinations produced by oslo_config.cfg), making oslo_config.cfg unable to later retrieve the value (because it's retrieving the intended destination, with an underscore, rather than the actual destination, with a hyphen).

Change abandoned by Dolph Mathews (<email address hidden>) on branch: master
Review: https://review.openstack.org/450928
Reason: Superceded by https://review.openstack.org/#/c/451947/

Changed in oslo.config:
assignee: Dolph Mathews (dolph) → Stephen Finucane (stephenfinucane)

Reviewed: https://review.openstack.org/450956
Committed: https://git.openstack.org/cgit/openstack/oslo.config/commit/?id=b5f76a2ce8323ae89e85b599c2aec5a89a49eabd
Submitter: Zuul
Branch: master

commit b5f76a2ce8323ae89e85b599c2aec5a89a49eabd
Author: Dolph Mathews <email address hidden>
Date: Tue Mar 28 19:48:48 2017 +0000

    Unit tests to illustrate positional argument bug

    This patch does not provide a fix, but instead serves to illustrate
    several use cases where positional arguments do not behave correctly on
    the CLI.

    Change-Id: Ibdb05066b95a285f6618c861eb4d38465dbf0d02
    Related-Bug: 1676989

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

Other bug subscribers