Move keystone.server.common to keystone.server
The common functions are mostly removed and these make sense to be part of the __init__.py. This also simplifies imports and eliminates odd import errors due to duplicated names and masking the names e.g. (and keystone.server.flask needs the functions from keystone.server.common): keystone.server.flask.common keystone.server.common Change-Id: Ie586fd45e10c8a1c8db3d9a64f949c97004814d9 Partial-Bug: #1776504
This commit is contained in:
parent
fb0299f661
commit
1caba2a448
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue