From 899a140f32880cf33472f792e542ba0db15b4aac Mon Sep 17 00:00:00 2001 From: Sarafraj Singh Date: Tue, 17 May 2016 13:59:33 -0500 Subject: [PATCH] Deprecate barbican options 1. Deprecating barbican options as these are moved to Castellan library. 2. Added new formatting Blueprint centralize-config-options-newton Change-Id: Ic8bd86e2652b7702c039ea1d2e15a7bf5a2a9586 --- nova/conf/barbican.py | 76 +++++++++++++------ nova/keymgr/__init__.py | 3 - ...bican-config-options-68ae65643ac41e2f.yaml | 6 ++ 3 files changed, 59 insertions(+), 26 deletions(-) create mode 100644 releasenotes/notes/deprecate-barbican-config-options-68ae65643ac41e2f.yaml diff --git a/nova/conf/barbican.py b/nova/conf/barbican.py index c84694837b92..ef8e5b50bfd4 100644 --- a/nova/conf/barbican.py +++ b/nova/conf/barbican.py @@ -1,10 +1,3 @@ -# needs:fix_opt_description -# needs:check_deprecation_status -# needs:check_opt_group_and_type -# needs:fix_opt_description_indentation -# needs:fix_opt_registration_consistency - - # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -19,35 +12,72 @@ # License for the specific language governing permissions and limitations # under the License. +from castellan import options as castellan_opts from keystoneauth1 import loading as ks_loading from oslo_config import cfg +# All barbican related code and options have been moved to +# a separate library the Castellan. Deprecating these option for +# Newton. These will be deleted post Newton + barbican_group = cfg.OptGroup( - 'barbican', - title='Barbican options') + "barbican", + title="Barbican options") barbican_opts = [ - cfg.StrOpt('catalog_info', - default='key-manager:barbican:public', - help='Info to match when looking for barbican in the service ' - 'catalog. Format is: separated values of the form: ' - '::'), - cfg.StrOpt('endpoint_template', - help='Override service catalog lookup with template for ' - 'barbican endpoint e.g. ' - 'http://localhost:9311/v1/%(project_id)s'), - cfg.StrOpt('os_region_name', - help='Region name of this node'), + cfg.StrOpt("catalog_info", + default="key-manager:barbican:public", + deprecated_for_removal=True, + deprecated_reason="This option have been moved to the " + "Castellan library", + help=""" +Info to match when looking for barbican in the service +catalog. Format is: separated values of the form: +:: +"""), + cfg.StrOpt("endpoint_template", + deprecated_for_removal=True, + deprecated_reason="This option have been moved to the " + "Castellan library", + help=""" +Override service catalog lookup with template for +barbican endpoint e.g. +http://localhost:9311/v1/%(project_id)s +"""), + cfg.StrOpt("os_region_name", + deprecated_for_removal=True, + deprecated_reason="This option have been moved to the " + "Castellan library", + help=""" +Region name of this node +"""), ] def register_opts(conf): + castellan_opts.set_defaults(conf) + # TODO(raj_singh): Code block below is deprecated and will be removed + # post Newton conf.register_group(barbican_group) conf.register_opts(barbican_opts, group=barbican_group) ks_loading.register_session_conf_options(conf, barbican_group.name) def list_opts(): - return { - barbican_group.name: barbican_opts - } + # Castellan library also has a group name barbican. So if we append + # list returned from barbican to this list, oslo will remove one group as + # duplicate and only one group (either from this file or Castellan library) + # will show up. + # So fix is to merge options of this file to "barbican" group returned from + # Castellan + opts = {barbican_group.name: barbican_opts} + for group, options in castellan_opts.list_opts(): + if group not in opts.keys(): + opts[group] = options + else: + opts[group] = opts[group] + options + return opts + # TODO(raj_singh): Post Newton delete code block from above and comment in + # line below. Castellan already returned a list which can be returned + # directly from list_opts() + # return castellan_opts.list_opts() diff --git a/nova/keymgr/__init__.py b/nova/keymgr/__init__.py index 67dbb3ecc4df..300fa82ba3e1 100644 --- a/nova/keymgr/__init__.py +++ b/nova/keymgr/__init__.py @@ -14,7 +14,6 @@ # under the License. -from castellan import options as castellan_opts from oslo_config import cfg from oslo_log import log as logging from oslo_utils import importutils @@ -26,8 +25,6 @@ LOG = logging.getLogger(__name__) CONF = nova.conf.CONF -castellan_opts.set_defaults(CONF) - # NOTE(kfarr): This line can be removed when a value is assigned in DevStack CONF.set_default('api_class', 'nova.keymgr.conf_key_mgr.ConfKeyManager', group='key_manager') diff --git a/releasenotes/notes/deprecate-barbican-config-options-68ae65643ac41e2f.yaml b/releasenotes/notes/deprecate-barbican-config-options-68ae65643ac41e2f.yaml new file mode 100644 index 000000000000..c6e3ae23b156 --- /dev/null +++ b/releasenotes/notes/deprecate-barbican-config-options-68ae65643ac41e2f.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - All barbican config options in Nova are now + deprecated and may be removed as early as 15.0.0 + release. All of these options are moved to the + Castellan library.