OpenStack library for config
Go to file
Dolph Mathews 18d1617caa Assume positional arguments are required
The 'positional' keyword specifically applies to oslo.config's argparse
support. Unlike oslo.config, argparse assumes that all positional
arguments are required by default, and you have to explicitly tell it
that a positional argument is optional if you'd like to opt into that
behavior.

This patch adopts that same behavior for oslo.config. When you define an
option to be non-positional (oslo.config's default, designed for config
files), then oslo.config makes that option optional:

However, when you define an option to be positional, oslo.config assumes
that the option is primarily going to be used on the CLI and thus sets
it as required, by default.

This change in behavior has the side effect of allowing argparse to
enforce required arguments on the CLI *while* parsing arguments, instead
of depending on oslo.config to detect the condition *after* argparse has
been allowed to parse "invalid" arguments. argparse correctly raises a
SystemExit in this case, and prints the actual command usage and a "hey,
you forgot this required argument", instead of allowing oslo.config to
dump a backtrace to the CLI with a context-less error message
("context-less" in that no useful CLI usage information is dumped along
with the crash to help you correct the condition).

Change-Id: Ifdc6918444fe72f7e1649483c237cce64b4c72d8
Partial-Bug: 1676989
2017-03-30 18:24:31 +00:00
.zuul.d Switch to Ussuri jobs 2019-10-24 14:26:24 +08:00
doc Assume positional arguments are required 2017-03-30 18:24:31 +00:00
oslo_config Assume positional arguments are required 2017-03-30 18:24:31 +00:00
releasenotes Assume positional arguments are required 2017-03-30 18:24:31 +00:00
.coveragerc Fix coverage configuration and execution 2015-10-05 17:20:49 -04:00
.gitignore Clean up the unnecessary sphinx from test-requirements.txt 2019-07-07 11:59:49 +08:00
.gitreview OpenDev Migration Patch 2019-04-19 19:35:49 +00:00
.stestr.conf Migrating oslo.config to use stestr 2019-01-15 16:15:34 +08:00
CONTRIBUTING.rst trivial change to contributing instructions 2018-02-19 09:51:56 -05:00
HACKING.rst Update URLs in documents according to document migration 2017-07-12 22:32:03 +08:00
LICENSE Add LICENSE file 2013-02-17 09:25:32 +00:00
README.rst update source link in readme 2019-10-15 10:53:35 +08:00
bindep.txt Add bindep.txt file to prevent fallback to generic list 2018-03-20 10:26:47 -05:00
lower-constraints.txt tox: Keeping going with docs 2019-10-24 14:04:44 +08:00
requirements.txt Resolve deprecation warning for rfc3986 uri validation 2018-12-25 14:56:21 +03:00
setup.cfg Add Python 3 Train unit tests 2019-07-05 14:43:07 -04:00
setup.py Updated from global requirements 2017-03-03 00:02:50 +00:00
test-requirements.txt Clean up the unnecessary sphinx from test-requirements.txt 2019-07-07 11:59:49 +08:00
tox.ini Stop configuring install_command in tox. 2019-11-14 15:05:29 +01:00

README.rst

Team and repository tags

image

Oslo Configuration Library

Latest Version

Downloads

The Oslo configuration API supports parsing command line arguments and .ini style configuration files.