From 5af99c7545a72d300281f6c278abb6e10760d9ee Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 23 Aug 2016 17:39:49 +0100 Subject: [PATCH] conf: Make list->dict conversion more specific All of the Nova configuration options' 'list_opts' functions have been updated to return dicts rather than lists of tuples. However, two dependency libraries still return dicts. Replace the general handling code for this with specific code in the two offending places. This gives a more actionable resolution. Blueprint centralize-config-options-ocata Change-Id: I5ce9ac2037e4374215a96e09e12b0873c31dd27e --- nova/conf/cache.py | 3 ++- nova/conf/opts.py | 11 ----------- nova/conf/ssl.py | 3 ++- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/nova/conf/cache.py b/nova/conf/cache.py index cccabf7d7d96..775368ec2198 100644 --- a/nova/conf/cache.py +++ b/nova/conf/cache.py @@ -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()) diff --git a/nova/conf/opts.py b/nova/conf/opts.py index 1bb5dcc0dc04..9aed6b28c234 100644 --- a/nova/conf/opts.py +++ b/nova/conf/opts.py @@ -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) diff --git a/nova/conf/ssl.py b/nova/conf/ssl.py index d0370ce0c1de..8d59ae653220 100644 --- a/nova/conf/ssl.py +++ b/nova/conf/ssl.py @@ -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())