Config options: Centralize consoleauth options

The config options of the section
"nova/consoleauth" got moved to the new central
location "nova/conf/consoleauth.py"

Change-Id: Ia9d875b62cc97065e102aeb17c19bdc074e35208
Implements: blueprint centralize-config-options-newton
This commit is contained in:
Pushkar Umaranikar 2016-03-15 20:04:26 +00:00 committed by John Garbutt
parent aecefcb9dd
commit d05a7ddaae
6 changed files with 40 additions and 26 deletions

View File

@ -17,18 +17,16 @@
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 version
CONF = cfg.CONF
CONF.import_opt('consoleauth_topic', 'nova.consoleauth')
CONF = nova.conf.CONF
def main():

View File

@ -33,6 +33,7 @@ from nova.conf import compute
from nova.conf import conductor
# from nova.conf import configdrive
# from nova.conf import console
from nova.conf import consoleauth
# from nova.conf import cors
# from nova.conf import cors.subdomain
# from nova.conf import crypto
@ -93,6 +94,7 @@ compute.register_opts(CONF)
conductor.register_opts(CONF)
# configdrive.register_opts(CONF)
# console.register_opts(CONF)
consoleauth.register_opts(CONF)
# cors.register_opts(CONF)
# cors.subdomain.register_opts(CONF)
# crypto.register_opts(CONF)

36
nova/conf/consoleauth.py Normal file
View File

@ -0,0 +1,36 @@
# Copyright (c) 2016 Intel, Inc.
# Copyright (c) 2013 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
consoleauth_topic_opt = cfg.StrOpt('consoleauth_topic',
default='consoleauth',
help='The topic console auth proxy nodes listen on')
console_token_ttl = cfg.IntOpt('console_token_ttl',
default=600,
help='How many seconds before deleting tokens')
CONSOLEAUTH_OPTS = [consoleauth_topic_opt, console_token_ttl]
def register_opts(conf):
conf.register_opts(CONSOLEAUTH_OPTS)
def list_opts():
return {'DEFAULT': CONSOLEAUTH_OPTS}

View File

@ -15,13 +15,3 @@
# limitations under the License.
"""Module to authenticate Consoles."""
from oslo_config import cfg
consoleauth_topic_opt = cfg.StrOpt('consoleauth_topic',
default='consoleauth',
help='The topic console auth proxy nodes listen on')
CONF = cfg.CONF
CONF.register_opt(consoleauth_topic_opt)

View File

@ -18,7 +18,6 @@
import time
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_serialization import jsonutils
@ -34,14 +33,7 @@ from nova import objects
LOG = logging.getLogger(__name__)
consoleauth_opts = [
cfg.IntOpt('console_token_ttl',
default=600,
help='How many seconds before deleting tokens')
]
CONF = nova.conf.CONF
CONF.register_opts(consoleauth_opts)
class ConsoleAuthManager(manager.Manager):

View File

@ -24,8 +24,6 @@ import nova.console.manager
import nova.console.rpcapi
import nova.console.serial
import nova.console.xvp
import nova.consoleauth
import nova.consoleauth.manager
import nova.consoleauth.rpcapi
import nova.crypto
import nova.db.api
@ -57,7 +55,6 @@ def list_opts():
('DEFAULT',
itertools.chain(
[nova.conductor.tasks.live_migrate.migrate_opt],
[nova.consoleauth.consoleauth_topic_opt],
[nova.db.base.db_driver_opt],
[nova.ipv6.api.ipv6_backend_opt],
[nova.servicegroup.api.servicegroup_driver_opt],
@ -66,7 +63,6 @@ def list_opts():
nova.console.manager.console_manager_opts,
nova.console.rpcapi.rpcapi_opts,
nova.console.xvp.xvp_opts,
nova.consoleauth.manager.consoleauth_opts,
nova.crypto.crypto_opts,
nova.db.api.db_opts,
nova.db.sqlalchemy.api.db_opts,