Merge "conf: Make list->dict conversion more specific"
This commit is contained in:
commit
6383894a33
|
@ -23,4 +23,5 @@ def register_opts(conf):
|
|||
|
||||
|
||||
def list_opts():
|
||||
return core._opts.list_opts()
|
||||
# The oslo_cache library returns a list of tuples
|
||||
return dict(core._opts.list_opts())
|
||||
|
|
|
@ -72,19 +72,8 @@ def _import_modules(module_names):
|
|||
return imported_modules
|
||||
|
||||
|
||||
def _process_old_opts(configs):
|
||||
"""Convert old-style 2-tuple configs to dicts."""
|
||||
if isinstance(configs, tuple):
|
||||
configs = [configs]
|
||||
return {label: options for label, options in configs}
|
||||
|
||||
|
||||
def _append_config_options(imported_modules, config_options):
|
||||
for mod in imported_modules:
|
||||
configs = mod.list_opts()
|
||||
# TODO(markus_z): Remove this compatibility shim once all list_opts()
|
||||
# functions have been updated to return dicts.
|
||||
if not isinstance(configs, dict):
|
||||
configs = _process_old_opts(configs)
|
||||
for key, val in configs.items():
|
||||
config_options[key].extend(val)
|
||||
|
|
|
@ -21,4 +21,5 @@ def register_opts(conf):
|
|||
|
||||
|
||||
def list_opts():
|
||||
return sslutils.list_opts()
|
||||
# The oslo_cache library returns a list of tuples
|
||||
return dict(sslutils.list_opts())
|
||||
|
|
Loading…
Reference in New Issue