def prepare_service(service_name, argv=[]):
"""
Initializes the various galaxia services
:param service_name: Name of the service
:param argv: Configuration file
:return:
"""
cfg.CONF(argv[1:], project='galaxia')
opt_group = cfg.OptGroup(name=service_name, title='Logging options for\
the service')
cfg.CONF.register_group(opt_group)
cfg.CONF.register_opts(LOGGING_SERVICE_OPTS, opt_group)
log_file = cfg.CONF._get("log_file", group=opt_group)
log_level = cfg.CONF._get("log_level", group=opt_group)
log_helper.setup_logging(log_file, log_level)
db_group = cfg.OptGroup(name='db', title='Options for the database')
cfg.CONF.register_group(db_group)
cfg.CONF.register_opts(DB_SERVICE_OPTS, db_group)
cfg.CONF.set_override('db_host', cfg.CONF.db.db_host, db_group)
cfg.CONF.set_override('type', cfg.CONF.db.type, db_group)
cfg.CONF.set_override('db_location', cfg.CONF.db.db_location, db_group)
sql_helper.init_db(cfg.CONF.db.type, cfg.CONF.db.username,
cfg.CONF.db.password, cfg.CONF.db.db_host, "galaxia", cfg.CONF.db.db_location)
load_mapping.initialize()
评论列表
文章目录