Merge keystone.config into keystone.common.config
Having two places for config stuff is confusing. There should only be the one place for config stuff, keystone.common.config. Change-Id: I83cae5d2140639df228025851ceb3f90c21af08a
This commit is contained in:
parent
40453931a9
commit
a751604fe0
|
@ -23,11 +23,11 @@ from oslo_utils import importutils
|
|||
import six
|
||||
import stevedore
|
||||
|
||||
from keystone.common import config
|
||||
from keystone.common import controller
|
||||
from keystone.common import dependency
|
||||
from keystone.common import utils
|
||||
from keystone.common import wsgi
|
||||
from keystone import config
|
||||
from keystone import exception
|
||||
from keystone.i18n import _, _LI, _LW
|
||||
from keystone.resource import controllers as resource_controllers
|
||||
|
|
|
@ -22,12 +22,12 @@ from oslo_log import log
|
|||
from oslo_serialization import jsonutils
|
||||
import pbr.version
|
||||
|
||||
from keystone.common import config
|
||||
from keystone.common import driver_hints
|
||||
from keystone.common import openssl
|
||||
from keystone.common import sql
|
||||
from keystone.common.sql import migration_helpers
|
||||
from keystone.common import utils
|
||||
from keystone import config
|
||||
from keystone import exception
|
||||
from keystone.federation import idp
|
||||
from keystone.federation import utils as mapping_engine
|
||||
|
|
|
@ -12,11 +12,17 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from oslo_cache import core as cache
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import oslo_messaging
|
||||
import passlib.utils
|
||||
|
||||
from keystone import exception
|
||||
|
||||
|
||||
_DEFAULT_AUTH_METHODS = ['external', 'password', 'token', 'oauth1']
|
||||
_CERTFILE = '/etc/keystone/ssl/certs/signing_cert.pem'
|
||||
|
@ -1126,6 +1132,68 @@ def setup_authentication(conf=None):
|
|||
_register_auth_plugin_opt(conf, option)
|
||||
|
||||
|
||||
def set_default_for_default_log_levels():
|
||||
"""Set the default for the default_log_levels option for keystone.
|
||||
|
||||
Keystone uses some packages that other OpenStack services don't use that do
|
||||
logging. This will set the default_log_levels default level for those
|
||||
packages.
|
||||
|
||||
This function needs to be called before CONF().
|
||||
|
||||
"""
|
||||
extra_log_level_defaults = [
|
||||
'dogpile=INFO',
|
||||
'routes=INFO',
|
||||
'keystone.common._memcache_pool=INFO',
|
||||
]
|
||||
|
||||
log.register_options(CONF)
|
||||
CONF.set_default('default_log_levels',
|
||||
CONF.default_log_levels + extra_log_level_defaults)
|
||||
|
||||
|
||||
def setup_logging():
|
||||
"""Sets up logging for the keystone package."""
|
||||
log.setup(CONF, 'keystone')
|
||||
logging.captureWarnings(True)
|
||||
|
||||
|
||||
def find_paste_config():
|
||||
"""Find Keystone's paste.deploy configuration file.
|
||||
|
||||
Keystone's paste.deploy configuration file is specified in the
|
||||
``[paste_deploy]`` section of the main Keystone configuration file,
|
||||
``keystone.conf``.
|
||||
|
||||
For example::
|
||||
|
||||
[paste_deploy]
|
||||
config_file = keystone-paste.ini
|
||||
|
||||
:returns: The selected configuration filename
|
||||
:raises: exception.ConfigFileNotFound
|
||||
|
||||
"""
|
||||
if CONF.paste_deploy.config_file:
|
||||
paste_config = CONF.paste_deploy.config_file
|
||||
paste_config_value = paste_config
|
||||
if not os.path.isabs(paste_config):
|
||||
paste_config = CONF.find_file(paste_config)
|
||||
elif CONF.config_file:
|
||||
paste_config = CONF.config_file[0]
|
||||
paste_config_value = paste_config
|
||||
else:
|
||||
# this provides backwards compatibility for keystone.conf files that
|
||||
# still have the entire paste configuration included, rather than just
|
||||
# a [paste_deploy] configuration section referring to an external file
|
||||
paste_config = CONF.find_file('keystone.conf')
|
||||
paste_config_value = 'keystone.conf'
|
||||
if not paste_config or not os.path.exists(paste_config):
|
||||
raise exception.ConfigFileNotFound(config_file=paste_config_value)
|
||||
return paste_config
|
||||
|
||||
|
||||
def configure(conf=None):
|
||||
if conf is None:
|
||||
conf = CONF
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
# Copyright 2012 OpenStack Foundation
|
||||
#
|
||||
# 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.
|
||||
"""Wrapper for keystone.common.config that configures itself on import."""
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from keystone.common import config
|
||||
from keystone import exception
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
setup_authentication = config.setup_authentication
|
||||
configure = config.configure
|
||||
|
||||
|
||||
def set_default_for_default_log_levels():
|
||||
"""Set the default for the default_log_levels option for keystone.
|
||||
|
||||
Keystone uses some packages that other OpenStack services don't use that do
|
||||
logging. This will set the default_log_levels default level for those
|
||||
packages.
|
||||
|
||||
This function needs to be called before CONF().
|
||||
|
||||
"""
|
||||
extra_log_level_defaults = [
|
||||
'dogpile=INFO',
|
||||
'routes=INFO',
|
||||
'keystone.common._memcache_pool=INFO',
|
||||
]
|
||||
|
||||
log.register_options(CONF)
|
||||
CONF.set_default('default_log_levels',
|
||||
CONF.default_log_levels + extra_log_level_defaults)
|
||||
|
||||
|
||||
def setup_logging():
|
||||
"""Sets up logging for the keystone package."""
|
||||
log.setup(CONF, 'keystone')
|
||||
logging.captureWarnings(True)
|
||||
|
||||
|
||||
def find_paste_config():
|
||||
"""Find Keystone's paste.deploy configuration file.
|
||||
|
||||
Keystone's paste.deploy configuration file is specified in the
|
||||
``[paste_deploy]`` section of the main Keystone configuration file,
|
||||
``keystone.conf``.
|
||||
|
||||
For example::
|
||||
|
||||
[paste_deploy]
|
||||
config_file = keystone-paste.ini
|
||||
|
||||
:returns: The selected configuration filename
|
||||
:raises: exception.ConfigFileNotFound
|
||||
|
||||
"""
|
||||
if CONF.paste_deploy.config_file:
|
||||
paste_config = CONF.paste_deploy.config_file
|
||||
paste_config_value = paste_config
|
||||
if not os.path.isabs(paste_config):
|
||||
paste_config = CONF.find_file(paste_config)
|
||||
elif CONF.config_file:
|
||||
paste_config = CONF.config_file[0]
|
||||
paste_config_value = paste_config
|
||||
else:
|
||||
# this provides backwards compatibility for keystone.conf files that
|
||||
# still have the entire paste configuration included, rather than just
|
||||
# a [paste_deploy] configuration section referring to an external file
|
||||
paste_config = CONF.find_file('keystone.conf')
|
||||
paste_config_value = 'keystone.conf'
|
||||
if not paste_config or not os.path.exists(paste_config):
|
||||
raise exception.ConfigFileNotFound(config_file=paste_config_value)
|
||||
return paste_config
|
|
@ -25,10 +25,10 @@ import six
|
|||
|
||||
from keystone.common import cache
|
||||
from keystone.common import clean
|
||||
from keystone.common import config
|
||||
from keystone.common import dependency
|
||||
from keystone.common import driver_hints
|
||||
from keystone.common import manager
|
||||
from keystone import config
|
||||
from keystone import exception
|
||||
from keystone.i18n import _, _LW
|
||||
from keystone.identity.mapping_backends import mapping
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from keystone.common import config
|
||||
from keystone.common import dependency
|
||||
from keystone.common import sql
|
||||
from keystone import config
|
||||
from keystone.i18n import _LW
|
||||
from keystone.server import backends
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ import pbr.version
|
|||
oslo_i18n.enable_lazy()
|
||||
|
||||
|
||||
from keystone.common import config
|
||||
from keystone.common import environment
|
||||
from keystone.common import utils
|
||||
from keystone import config
|
||||
from keystone.i18n import _
|
||||
from keystone.server import common
|
||||
from keystone.version import service as keystone_service
|
||||
|
|
|
@ -25,8 +25,8 @@ import oslo_i18n
|
|||
oslo_i18n.enable_lazy()
|
||||
|
||||
|
||||
from keystone.common import config
|
||||
from keystone.common import environment
|
||||
from keystone import config
|
||||
from keystone.server import common
|
||||
from keystone.version import service as keystone_service
|
||||
|
||||
|
|
|
@ -45,12 +45,11 @@ from keystone.common import environment # noqa
|
|||
environment.use_eventlet()
|
||||
|
||||
from keystone import auth
|
||||
from keystone.common import config as common_cfg
|
||||
from keystone.common import config
|
||||
from keystone.common import dependency
|
||||
from keystone.common import kvs
|
||||
from keystone.common.kvs import core as kvs_core
|
||||
from keystone.common import sql
|
||||
from keystone import config
|
||||
from keystone import exception
|
||||
from keystone import notifications
|
||||
from keystone.policy.backends import rules
|
||||
|
@ -517,7 +516,7 @@ class TestCase(BaseTestCase):
|
|||
def auth_plugin_config_override(self, methods=None, **method_classes):
|
||||
if methods is not None:
|
||||
self.config_fixture.config(group='auth', methods=methods)
|
||||
common_cfg.setup_authentication()
|
||||
config.setup_authentication()
|
||||
if method_classes:
|
||||
self.config_fixture.config(group='auth', **method_classes)
|
||||
|
||||
|
@ -538,7 +537,7 @@ class TestCase(BaseTestCase):
|
|||
def mocked_register_auth_plugin_opt(conf, opt):
|
||||
self.config_fixture.register_opt(opt, group='auth')
|
||||
self.useFixture(mockpatch.PatchObject(
|
||||
common_cfg, '_register_auth_plugin_opt',
|
||||
config, '_register_auth_plugin_opt',
|
||||
new=mocked_register_auth_plugin_opt))
|
||||
|
||||
self.config_overrides()
|
||||
|
|
|
@ -26,7 +26,7 @@ from testtools import matchers
|
|||
from keystone import assignment
|
||||
from keystone import auth
|
||||
from keystone.common import authorization
|
||||
from keystone import config
|
||||
from keystone.common import config
|
||||
from keystone import exception
|
||||
from keystone.models import token_model
|
||||
from keystone.tests import unit
|
||||
|
|
|
@ -16,7 +16,7 @@ import uuid
|
|||
|
||||
from oslo_config import cfg
|
||||
|
||||
from keystone import config
|
||||
from keystone.common import config
|
||||
from keystone import exception
|
||||
from keystone.tests import unit
|
||||
|
||||
|
|
Loading…
Reference in New Issue