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:
parent
a2b2324a3d
commit
1d25f383ba
|
@ -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)
|
||||
------------------
|
||||
|
||||
|
|
|
@ -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'])
|
||||
|
|
Loading…
Reference in New Issue