def configure(version=None, config_files=None): config.configure() sql.initialize() config.set_default_for_default_log_levels() CONF(project='keystone', version=version, default_config_files=config_files) config.setup_logging()
def main(argv=None, config_files=None): CONF.register_cli_opt(command_opt) config.configure() sql.initialize() CONF(args=argv[1:], project='keystone', version=pbr.version.VersionInfo('keystone').version_string(), usage='%(prog)s [' + '|'.join([cmd.name for cmd in CMDS]) + ']', default_config_files=config_files) config.setup_logging() CONF.command.cmd_class.main()
def main(argv=None, config_files=None): CONF.register_cli_opt(command_opt) config.configure() sql.initialize() config.set_default_for_default_log_levels() CONF(args=argv[1:], project='keystone', version='2014.1.fuel5.0', usage='%(prog)s [' + '|'.join([cmd.name for cmd in CMDS]) + ']', default_config_files=config_files) config.setup_logging() CONF.command.cmd_class.main()
def main(argv=None, config_files=None): CONF.register_cli_opt(command_opt) config.configure() sql.initialize() config.set_default_for_default_log_levels() CONF(args=argv[1:], project='keystone', version='2014.1.2.1', usage='%(prog)s [' + '|'.join([cmd.name for cmd in CMDS]) + ']', default_config_files=config_files) config.setup_logging() CONF.command.cmd_class.main()
def configure(version=None, config_files=None, pre_setup_logging_fn=lambda: None): config.configure() sql.initialize() config.set_default_for_default_log_levels() CONF(project='keystone', version=version, default_config_files=config_files) pre_setup_logging_fn() config.setup_logging() if CONF.debug: LOG.warn(_LW( 'debug is enabled so responses may include sensitive ' 'information.'))
def _load_config(self, assignment_api, file_list, domain_name): try: domain_ref = assignment_api.get_domain_by_name(domain_name) except exception.DomainNotFound: LOG.warning(_("Invalid domain name (%s) found in config file name"), domain_name) return # Create a new entry in the domain config dict, which contains # a new instance of both the conf environment and driver using # options defined in this set of config files. Later, when we # service calls via this Manager, we'll index via this domain # config dict to make sure we call the right driver domain = domain_ref["id"] self[domain] = {} self[domain]["cfg"] = cfg.ConfigOpts() config.configure(conf=self[domain]["cfg"]) self[domain]["cfg"](args=[], project="keystone", default_config_files=file_list) self._load_driver(assignment_api, domain)
def _load_config(self, assignment_api, file_list, domain_name): try: domain_ref = assignment_api.get_domain_by_name(domain_name) except exception.DomainNotFound: msg = (_('Invalid domain name (%s) found in config file name') % domain_name) LOG.warning(msg) if domain_ref: # Create a new entry in the domain config dict, which contains # a new instance of both the conf environment and driver using # options defined in this set of config files. Later, when we # service calls via this Manager, we'll index via this domain # config dict to make sure we call the right driver domain = domain_ref['id'] self[domain] = {} self[domain]['cfg'] = cfg.ConfigOpts() config.configure(conf=self[domain]['cfg']) self[domain]['cfg'](args=[], project='keystone', default_config_files=file_list) self._load_driver(assignment_api, domain)
def _load_config(self, assignment_api, file_list, domain_name): def assert_no_more_than_one_sql_driver(new_config, config_file): """Ensure there is more than one sql driver. Check to see if the addition of the driver in this new config would cause there to now be more than one sql driver. """ if (new_config['driver'].is_sql and (self.driver.is_sql or self._any_sql)): # The addition of this driver would cause us to have more than # one sql driver, so raise an exception. raise exception.MultipleSQLDriversInConfig( config_file=config_file) self._any_sql = new_config['driver'].is_sql try: domain_ref = assignment_api.get_domain_by_name(domain_name) except exception.DomainNotFound: LOG.warning( _('Invalid domain name (%s) found in config file name'), domain_name) return # Create a new entry in the domain config dict, which contains # a new instance of both the conf environment and driver using # options defined in this set of config files. Later, when we # service calls via this Manager, we'll index via this domain # config dict to make sure we call the right driver domain_config = {} domain_config['cfg'] = cfg.ConfigOpts() config.configure(conf=domain_config['cfg']) domain_config['cfg'](args=[], project='keystone', default_config_files=file_list) domain_config['driver'] = self._load_driver( domain_config, assignment_api) assert_no_more_than_one_sql_driver(domain_config, file_list) self[domain_ref['id']] = domain_config
def _load_config(self, assignment_api, file_list, domain_name): def assert_no_more_than_one_sql_driver(new_config, config_file): """Ensure there is more than one sql driver. Check to see if the addition of the driver in this new config would cause there to now be more than one sql driver. """ if (new_config['driver'].is_sql and (self.driver.is_sql or self._any_sql)): # The addition of this driver would cause us to have more than # one sql driver, so raise an exception. raise exception.MultipleSQLDriversInConfig( config_file=config_file) self._any_sql = new_config['driver'].is_sql try: domain_ref = assignment_api.get_domain_by_name(domain_name) except exception.DomainNotFound: LOG.warning( _LW('Invalid domain name (%s) found in config file name'), domain_name) return # Create a new entry in the domain config dict, which contains # a new instance of both the conf environment and driver using # options defined in this set of config files. Later, when we # service calls via this Manager, we'll index via this domain # config dict to make sure we call the right driver domain_config = {} domain_config['cfg'] = cfg.ConfigOpts() config.configure(conf=domain_config['cfg']) domain_config['cfg'](args=[], project='keystone', default_config_files=file_list) domain_config['driver'] = self._load_driver(domain_config, assignment_api) assert_no_more_than_one_sql_driver(domain_config, file_list) self[domain_ref['id']] = domain_config
from keystone import auth from keystone.common import config as common_cfg from keystone.common import dependency from keystone.common import kvs from keystone.common.kvs import core as kvs_core from keystone import config from keystone import controllers from keystone import exception from keystone import notifications from keystone.policy.backends import rules from keystone.server import common from keystone import service from keystone.tests.unit import ksfixtures config.configure() LOG = log.getLogger(__name__) PID = six.text_type(os.getpid()) TESTSDIR = os.path.dirname(os.path.abspath(__file__)) TESTCONF = os.path.join(TESTSDIR, 'config_files') ROOTDIR = os.path.normpath(os.path.join(TESTSDIR, '..', '..', '..')) VENDOR = os.path.join(ROOTDIR, 'vendor') ETCDIR = os.path.join(ROOTDIR, 'etc') def _calc_tmpdir(): env_val = os.environ.get('KEYSTONE_TEST_TEMP_DIR') if not env_val: return os.path.join(TESTSDIR, 'tmp', PID) return os.path.join(env_val, PID)
from keystone import auth from keystone.common import config as common_cfg 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 controllers from keystone import exception from keystone import notifications from keystone.policy.backends import rules from keystone.server import common from keystone import service from keystone.tests.unit import ksfixtures config.configure() LOG = log.getLogger(__name__) PID = six.text_type(os.getpid()) TESTSDIR = os.path.dirname(os.path.abspath(__file__)) TESTCONF = os.path.join(TESTSDIR, 'config_files') ROOTDIR = os.path.normpath(os.path.join(TESTSDIR, '..', '..', '..')) VENDOR = os.path.join(ROOTDIR, 'vendor') ETCDIR = os.path.join(ROOTDIR, 'etc') def _calc_tmpdir(): env_val = os.environ.get('KEYSTONE_TEST_TEMP_DIR') if not env_val: return os.path.join(TESTSDIR, 'tmp', PID) return os.path.join(env_val, PID)
def get_application(configure=True): import os import sys import java.util from java.io import File from org.python.util import jython jar_location = (jython() .getClass() .getProtectionDomain() .getCodeSource() .getLocation() .getPath()) sys.executable = jar_location import pbr.version pbr.version.VersionInfo.version_string = lambda x: '' from keystone import backends from keystone import config from keystone.common import sql from oslo.db import options as db_options from keystone.common import dependency import logging from paste import deploy from java.lang import System logging.basicConfig() if configure: config.configure() CONF = config.CONF sql.initialize() prop_dir = System.getProperty("config_dir", "etc") if len(sys.argv) > 0: saved_argv = sys.argv sys.argv = [sys.argv[0]] config_file = ['{prop_dir}/keystone.conf'.format(prop_dir=prop_dir)] CONF(project='keystone', prog='keystone', default_config_files=config_file) name = 'main' name = 'admin' config.setup_logging() if CONF.debug: CONF.log_opt_values(logging.getLogger(CONF.prog), logging.DEBUG) elif CONF.verbose: CONF.log_opt_values(logging.getLogger(CONF.prog), logging.INFO) else: CONF.log_opt_values(logging.getLogger(CONF.prog), logging.WARNING) backends.load_backends() application = deploy.loadapp('config:{prop_dir}/keystone-paste.ini'.format( prop_dir=prop_dir), name=name, relative_to='.') dependency.resolve_future_dependencies() if len(sys.argv) > 0: sys.argv = saved_argv return application