generated default List ConfigType ignores bounds

Bug #1763239 reported by Brian Rosmaita
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.config
Fix Released
Undecided
Brian Rosmaita

Bug Description

The List ConfigType has a 'bounds' option to indicate whether brackets are required when the value is specified. The generated default value, however, does not pay attention to the 'bounds' option, and as a result the sample output is confusing.

For example, glance/common/config.py contains the following option definition:
    cfg.ListOpt('enabled_import_methods',
                item_type=cfg.types.String(quotes=True),
                bounds=True,
                default=['glance-direct', 'web-download'],
                help=_("""
List of enabled Image Import Methods
Both 'glance-direct' and 'web-download' are enabled by default.
Related options:
    * [DEFAULT]/node_staging_uri
    * [DEFAULT]/enable_image_import""")),

This shows up in the generated file like this:

#
# List of enabled Image Import Methods
#
# Both 'glance-direct' and 'web-download' are enabled by default.
#
# Related options:
# * [DEFAULT]/node_staging_uri
# * [DEFAULT]/enable_image_import (list value)
#enabled_import_methods = glance-direct,web-download

If the operator uncomments this setting, a ValueError('Value should start with "["') is raised when the config file is loaded. It would be better if the default value displayed respected the 'bounds' setting, given that the reader of the config file has no way to know that bounds are required without reading the code (or by trial and error).

Changed in oslo.config:
assignee: nobody → Brian Rosmaita (brian-rosmaita)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.config (master)

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

Changed in oslo.config:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.config (master)

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

commit a69701c495947a2bbe618e71e20d6203977a6943
Author: Brian Rosmaita <email address hidden>
Date: Wed Apr 11 22:46:33 2018 -0400

    Make List option format bounds-sensitive

    The List ConfigType has a boolean 'bounds' option that indicates
    whether the value must be enclosed in brackets. This patch modifies
    the List formatter so that when bounds=True the output is displayed
    in enclosing brackets.

    Change-Id: Ide3748e67d14191b6b33c97c7d8437e4888e61d5
    Closes-bug: #1763239

Changed in oslo.config:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.config 6.1.0

This issue was fixed in the openstack/oslo.config 6.1.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.