From c57aebac323bf31ce4da46438e68e954faa10f7f Mon Sep 17 00:00:00 2001 From: EdLeafe Date: Thu, 14 Jan 2016 19:24:16 +0000 Subject: [PATCH] Move config options from nova/cert directory This patch moves the config options in the files in the nova/cert directory into nova/conf/cert.py. Improved help text will follow in a dependent patch. Blueprint centralize-config-options Change-Id: Ib89ed26bed85238193bfaa36f0549abaa7d9426c --- nova/cert/rpcapi.py | 15 ++------------- nova/cmd/cert.py | 5 ++--- nova/conf/__init__.py | 2 ++ nova/conf/cert.py | 33 +++++++++++++++++++++++++++++++++ nova/opts.py | 3 --- 5 files changed, 39 insertions(+), 19 deletions(-) create mode 100644 nova/conf/cert.py diff --git a/nova/cert/rpcapi.py b/nova/cert/rpcapi.py index 2111bd5c1cbf..537b715d2e42 100644 --- a/nova/cert/rpcapi.py +++ b/nova/cert/rpcapi.py @@ -16,23 +16,12 @@ Client side of the cert manager RPC API. """ -from oslo_config import cfg import oslo_messaging as messaging +import nova.conf from nova import rpc -rpcapi_opts = [ - cfg.StrOpt('cert_topic', - default='cert', - help='The topic cert nodes listen on'), -] - -CONF = cfg.CONF -CONF.register_opts(rpcapi_opts) - -rpcapi_cap_opt = cfg.StrOpt('cert', - help='Set a version cap for messages sent to cert services') -CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels') +CONF = nova.conf.CONF class CertAPI(object): diff --git a/nova/cmd/cert.py b/nova/cmd/cert.py index e07df8d0fd27..9e199d779783 100644 --- a/nova/cmd/cert.py +++ b/nova/cmd/cert.py @@ -16,18 +16,17 @@ import sys -from oslo_config import cfg from oslo_log import log as logging from oslo_reports import guru_meditation_report as gmr +import nova.conf from nova import config from nova import objects from nova import service from nova import utils from nova import version -CONF = cfg.CONF -CONF.import_opt('cert_topic', 'nova.cert.rpcapi') +CONF = nova.conf.CONF def main(): diff --git a/nova/conf/__init__.py b/nova/conf/__init__.py index c9b8a7cd80ad..c4c997e19f3c 100644 --- a/nova/conf/__init__.py +++ b/nova/conf/__init__.py @@ -26,6 +26,7 @@ from oslo_config import cfg # from nova.conf import barbican # from nova.conf import base # from nova.conf import cells +from nova.conf import cert # from nova.conf import cinder # from nova.conf import cloudpipe from nova.conf import compute @@ -84,6 +85,7 @@ CONF = cfg.CONF # barbican.register_opts(CONF) # base.register_opts(CONF) # cells.register_opts(CONF) +cert.register_opts(CONF) # cinder.register_opts(CONF) # cloudpipe.register_opts(CONF) compute.register_opts(CONF) diff --git a/nova/conf/cert.py b/nova/conf/cert.py new file mode 100644 index 000000000000..ce4c8d5efdb5 --- /dev/null +++ b/nova/conf/cert.py @@ -0,0 +1,33 @@ +# Copyright 2016 IBM Corp. +# Copyright 2016 OpenStack Foundation +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from oslo_config import cfg + +cert_topic_opt = cfg.StrOpt("cert_topic", + default="cert", + help="The topic cert nodes listen on") +rpcapi_cap_opt = cfg.StrOpt("cert", + help="Set a version cap for messages sent to cert services") + + +def register_opts(conf): + conf.register_opts([cert_topic_opt]) + conf.register_opt(rpcapi_cap_opt, "upgrade_levels") + + +def list_opts(): + return {"DEFAULT": [cert_topic_opt], + "upgrade_levels": [rpcapi_cap_opt]} diff --git a/nova/opts.py b/nova/opts.py index 9d55498a8b9b..61705bc8d3ad 100644 --- a/nova/opts.py +++ b/nova/opts.py @@ -14,7 +14,6 @@ import itertools import nova.availability_zones import nova.baserpc -import nova.cert.rpcapi import nova.cloudpipe.pipelib import nova.cmd.novnc import nova.cmd.novncproxy @@ -72,7 +71,6 @@ def list_opts(): [nova.ipv6.api.ipv6_backend_opt], [nova.servicegroup.api.servicegroup_driver_opt], nova.availability_zones.availability_zone_opts, - nova.cert.rpcapi.rpcapi_opts, nova.cloudpipe.pipelib.cloudpipe_opts, nova.cmd.novnc.opts, nova.cmd.novncproxy.opts, @@ -120,7 +118,6 @@ def list_opts(): ('upgrade_levels', itertools.chain( [nova.baserpc.rpcapi_cap_opt], - [nova.cert.rpcapi.rpcapi_cap_opt], [nova.conductor.rpcapi.rpcapi_cap_opt], [nova.console.rpcapi.rpcapi_cap_opt], [nova.consoleauth.rpcapi.rpcapi_cap_opt],