Add value restriction on string config options

Bug #1123043 reported by Ionuț Arțăriși
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo-incubator
Fix Released
Wishlist
Davanum Srinivas (DIMS)

Bug Description

It would be great to have a way to restrict the values that a config option can take and have the option parser raise a descriptive error when this happens.

This could just be an extra argument to cfg.StrOpt (e.g. cfg.StrOpt('protocol', default='http', allowed=['http', 'https', 'ftp']) ) or a new option type altogether.

Revision history for this message
Mark McLoughlin (markmc) wrote :

Yeah, something like argparse's choices would be nice http://docs.python.org/dev/library/argparse.html#choices

Changed in oslo:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :
Changed in oslo:
assignee: nobody → Davanum Srinivas (DIMS) (dims-v)
status: Triaged → In Progress
Revision history for this message
Zhongyue Luo (zyluo) wrote :
Changed in oslo:
status: In Progress → Fix Released
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.