Fix config parse when caller has args

When the Python script using cinderlib had arguments we would get an
Oslo Config usage error when initializing cinderlib.

This was caused by the _CachedArgumentParser class parsing argv, so we
replace this parsing with NOOP.
This commit is contained in:
Gorka Eguileor 2019-01-22 20:13:08 +01:00
parent a2b2324a3d
commit 1d25f383ba
2 changed files with 10 additions and 0 deletions

View File

@ -2,6 +2,13 @@
History
=======
0.3.x (2019-01-xx)
------------------
- Bug fixes:
- Failure when the caller has arguments
0.3.1 (2019-01-16)
------------------

View File

@ -220,6 +220,9 @@ class Backend(object):
cfg.ConfigParser.parse = six.create_unbound_method(cls._config_parse,
cfg.ConfigParser)
# Replace command line arg parser so we ignore caller's args
cfg._CachedArgumentParser.parse_args = lambda *a, **kw: None
# Update the configuration with the options we have configured
cfg.CONF(project='cinder', version=cinderlib.__version__,
default_config_files=['in_memory_file'])