Repository URL to install this package:
Version:
4.1.94.6-4.1 ▾
|
# Copyright 2020 TrilioData Inc.
# All Rights Reserved.
from oslo_config import cfg
from oslo_db import options as oslo_db_options
from contego.conf import paths
_DEFAULT_SQL_CONNECTION = 'sqlite:///' + paths.state_path_def('contego.sqlite')
dmapi_db_group = cfg.OptGroup('dmapi_database',
title='Dmapi Database Options',
help="Dmapi Database")
dmapi_db_opts = [
cfg.StrOpt('connection',
secret=True,
help=''),
cfg.BoolOpt('sqlite_synchronous',
default=True,
help=''),
cfg.StrOpt('mysql_sql_mode',
default='TRADITIONAL',
help=''),
cfg.IntOpt('connection_recycle_time',
default=3600,
deprecated_name='idle_timeout',
help=''),
cfg.IntOpt('max_pool_size',
default=5,
help=''),
cfg.IntOpt('max_retries',
default=10,
help=''),
cfg.IntOpt('retry_interval',
default=10,
help=''),
cfg.IntOpt('max_overflow',
default=10,
help=''),
cfg.IntOpt('connection_debug',
default=0,
help=''),
cfg.BoolOpt('connection_trace',
default=False,
help=''),
cfg.IntOpt('pool_timeout',
default=30,
help='')
]
def enrich_help_text(alt_db_opts):
def get_db_opts():
for group_name, db_opts in oslo_db_options.list_opts():
if group_name == 'database':
return db_opts
return []
for db_opt in get_db_opts():
for alt_db_opt in alt_db_opts:
if alt_db_opt.name == db_opt.name:
# NOTE(markus_z): We can append alternative DB specific help
# texts here if needed.
alt_db_opt.help = db_opt.help + alt_db_opt.help
def register_opts(conf):
oslo_db_options.set_defaults(conf, connection=_DEFAULT_SQL_CONNECTION)
conf.register_opts(dmapi_db_opts, group=dmapi_db_group)
def list_opts():
# NOTE(markus_z): 2016-04-04: If we list the oslo_db_options here, they
# get emitted twice(!) in the "sample.conf" file. First under the
# namespace "dmapi.conf" and second under the namespace "oslo.db". This
# is due to the setting in file "etc/dmapi/dmapi-config-generator.conf".
# As I think it is useful to have the "oslo.db" namespace information
# in the "sample.conf" file, I omit the listing of the "oslo_db_options"
# here.
enrich_help_text(dmapi_db_opts)
return {'DEFAULT': [],
dmapi_db_group: dmapi_db_opts,
}