diff --git a/keystone/server/__init__.py b/keystone/server/__init__.py index e69de29bb2..33e13a9d40 100644 --- a/keystone/server/__init__.py +++ b/keystone/server/__init__.py @@ -0,0 +1,49 @@ + +# 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_log import log + +from keystone.common import sql +import keystone.conf +from keystone.server import backends + + +CONF = keystone.conf.CONF +LOG = log.getLogger(__name__) + + +def configure(version=None, config_files=None, + pre_setup_logging_fn=lambda: None): + keystone.conf.configure() + sql.initialize() + keystone.conf.set_config_defaults() + + CONF(project='keystone', version=version, + default_config_files=config_files) + + pre_setup_logging_fn() + keystone.conf.setup_logging() + + if CONF.insecure_debug: + LOG.warning( + 'insecure_debug is enabled so responses may include sensitive ' + 'information.') + + +def setup_backends(load_extra_backends_fn=lambda: {}, + startup_application_fn=lambda: None): + drivers = backends.load_backends() + drivers.update(load_extra_backends_fn()) + res = startup_application_fn() + return drivers, res diff --git a/keystone/server/common.py b/keystone/server/common.py deleted file mode 100644 index 33e13a9d40..0000000000 --- a/keystone/server/common.py +++ /dev/null @@ -1,49 +0,0 @@ - -# 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_log import log - -from keystone.common import sql -import keystone.conf -from keystone.server import backends - - -CONF = keystone.conf.CONF -LOG = log.getLogger(__name__) - - -def configure(version=None, config_files=None, - pre_setup_logging_fn=lambda: None): - keystone.conf.configure() - sql.initialize() - keystone.conf.set_config_defaults() - - CONF(project='keystone', version=version, - default_config_files=config_files) - - pre_setup_logging_fn() - keystone.conf.setup_logging() - - if CONF.insecure_debug: - LOG.warning( - 'insecure_debug is enabled so responses may include sensitive ' - 'information.') - - -def setup_backends(load_extra_backends_fn=lambda: {}, - startup_application_fn=lambda: None): - drivers = backends.load_backends() - drivers.update(load_extra_backends_fn()) - res = startup_application_fn() - return drivers, res diff --git a/keystone/server/flask/core.py b/keystone/server/flask/core.py index c7ae055e8c..ddcbe4295a 100644 --- a/keystone/server/flask/core.py +++ b/keystone/server/flask/core.py @@ -27,7 +27,7 @@ oslo_i18n.enable_lazy() from keystone.common import profiler import keystone.conf -from keystone.server import common +import keystone.server from keystone.server.flask import application # NOTE(morgan): Middleware Named Tuple with the following values: @@ -145,7 +145,7 @@ def initialize_application(name, post_log_configured_function=lambda: None, if os.path.exists(dev_conf): config_files = [dev_conf] - common.configure(config_files=config_files) + keystone.server.configure(config_files=config_files) # Log the options used when starting if we're in debug mode... if CONF.debug: @@ -159,7 +159,7 @@ def initialize_application(name, post_log_configured_function=lambda: None, app = application.application_factory(name) return app - _unused, app = common.setup_backends( + _unused, app = keystone.server.setup_backends( startup_application_fn=loadapp) # setup OSprofiler notifier and enable the profiling if that is configured diff --git a/keystone/tests/unit/ksfixtures/backendloader.py b/keystone/tests/unit/ksfixtures/backendloader.py index 217b090a56..834a0a9166 100644 --- a/keystone/tests/unit/ksfixtures/backendloader.py +++ b/keystone/tests/unit/ksfixtures/backendloader.py @@ -14,7 +14,7 @@ import fixtures from keystone import auth -from keystone.server import common +import keystone.server class BackendLoader(fixtures.Fixture): @@ -28,7 +28,7 @@ class BackendLoader(fixtures.Fixture): super(BackendLoader, self).setUp() self.clear_auth_plugin_registry() - drivers, _unused = common.setup_backends() + drivers, _unused = keystone.server.setup_backends() for manager_name, manager in drivers.items(): setattr(self._testcase, manager_name, manager)