Don't configure on import

The keystone.config package called config.configure() at import-
time.

This will make it obvious that developers can't use config
options at import-time because packages that do that will fail on
import.

Change-Id: I9306f67609d782e3f49fd43908448daf1287d51c
Related-Bug: #1265108
Related-Bug: #1265670
Closes-Bug: #1269785
This commit is contained in:
Brant Knudson 2014-01-02 18:44:47 -06:00
parent 5e7b4809aa
commit d542caa47e
7 changed files with 16 additions and 7 deletions

View File

@ -103,6 +103,7 @@ if __name__ == '__main__':
if os.path.exists(dev_conf):
config_files = [dev_conf]
config.configure()
sql.initialize()
CONF(project='keystone',

View File

@ -36,6 +36,7 @@ from keystone import service
CONF = config.CONF
config.configure()
sql.initialize()
CONF(project='keystone')

View File

@ -212,6 +212,7 @@ command_opt = cfg.SubCommandOpt('command',
def main(argv=None, config_files=None):
CONF.register_cli_opt(command_opt)
config.configure()
sql.initialize()
CONF(args=argv[1:],

View File

@ -22,7 +22,6 @@ from keystone import exception
from keystone.openstack.common import log
config.configure()
CONF = config.CONF
setup_authentication = config.setup_authentication

View File

@ -70,6 +70,9 @@ from keystone import service
from keystone.openstack.common import policy as common_policy # noqa
config.configure()
LOG = log.getLogger(__name__)
TESTSDIR = os.path.dirname(os.path.abspath(__file__))
ROOTDIR = os.path.normpath(os.path.join(TESTSDIR, '..', '..'))

View File

@ -17,14 +17,13 @@
# NOTE(dolph): please try to avoid additional fixtures if possible; test suite
# performance may be negatively affected.
from keystone import assignment
from keystone import config
CONF = config.CONF
DEFAULT_DOMAIN_ID = config.CONF.identity.default_domain_id
DEFAULT_DOMAIN_ID = 'default'
TENANTS = [
@ -104,8 +103,8 @@ ROLES = [
'id': 'member',
'name': 'Member',
}, {
'id': CONF.member_role_id,
'name': CONF.member_role_name,
'id': '9fe2ff9ee4384b1894a90878d3e92bab',
'name': '_member_',
}, {
'id': 'other',
'name': 'Other',
@ -121,4 +120,9 @@ ROLES = [
}
]
DOMAINS = [assignment.calc_default_domain()]
DOMAINS = [{'description':
(u'Owns users and tenants (i.e. projects)'
' available on Identity API v2.'),
'enabled': True,
'id': DEFAULT_DOMAIN_ID,
'name': u'Default'}]

View File

@ -30,7 +30,7 @@ from keystone.tests import rest
CONF = config.CONF
DEFAULT_DOMAIN_ID = CONF.identity.default_domain_id
DEFAULT_DOMAIN_ID = 'default'
TIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'