本文整理匯總了Python中oslo_config.cfg.NoSuchOptError方法的典型用法代碼示例。如果您正苦於以下問題:Python cfg.NoSuchOptError方法的具體用法?Python cfg.NoSuchOptError怎麽用?Python cfg.NoSuchOptError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類oslo_config.cfg
的用法示例。
在下文中一共展示了cfg.NoSuchOptError方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import NoSuchOptError [as 別名]
def __init__(self, message=None, **kwargs):
self.kwargs = kwargs
if 'code' not in self.kwargs and hasattr(self, 'code'):
self.kwargs['code'] = self.code
if message:
self.message = message
try:
self.message = self.message % kwargs
except KeyError:
# kwargs doesn't match a variable in the message
# log the issue and the kwargs
LOG.exception('Exception in string format operation, '
'kwargs: %s', kwargs)
try:
ferr = CONF.fatal_exception_format_errors
except cfg.NoSuchOptError:
ferr = CONF.oslo_versionedobjects.fatal_exception_format_errors
if ferr:
raise
super(ZunException, self).__init__(self.message)
示例2: set_user_creds
# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import NoSuchOptError [as 別名]
def set_user_creds(cls, config):
# normal user creds
# Fixme(eliqiao): this is quick workaround to passing tempest
# legacy credentials provider is removed by tempest
# I8c24cd17f643083dde71ab2bd2a38417c54aeccb.
# TODO(eliqiao): find a way to using an accounts.yaml file
# check Ia5132c5cb32355d6f26b8acdd92a0e55a2c19f41
cls.user = CONF.auth.admin_username
cls.passwd = CONF.auth.admin_password
# NOTE(toabctl): also allow the old style tempest definition
try:
cls.tenant = CONF.auth.admin_project_name
except cfg.NoSuchOptError:
cls.tenant = CONF.auth.admin_tenant_name
warnings.warn("the config option 'admin_tenant_name' from the "
"'auth' section is deprecated. Please switch "
"to 'admin_project_name'.")
示例3: __init__
# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import NoSuchOptError [as 別名]
def __init__(self, message=None, **kwargs):
self.kwargs = kwargs
if 'code' not in self.kwargs and hasattr(self, 'code'):
self.kwargs['code'] = self.code
if message:
self.message = message
try:
self.message = self.message % kwargs
except Exception:
# kwargs doesn't match a variable in the message
# log the issue and the kwargs
LOG.exception('Exception in string format operation, '
'kwargs: %s', kwargs)
try:
if CONF.fatal_exception_format_errors:
raise
except cfg.NoSuchOptError:
# Note: work around for Bug: #1447873
if CONF.oslo_versionedobjects.fatal_exception_format_errors:
raise
super(MagnumException, self).__init__(self.message)
示例4: set_mysql_engine
# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import NoSuchOptError [as 別名]
def set_mysql_engine():
try:
mysql_engine = neutron_config.command.mysql_engine
except cfg.NoSuchOptError:
mysql_engine = None
global MYSQL_ENGINE
MYSQL_ENGINE = (mysql_engine or
model_base.BASEV2.__table_args__['mysql_engine'])
示例5: is_loaded
# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import NoSuchOptError [as 別名]
def is_loaded(self):
try:
return (odl_const.ODL_ML2_MECH_DRIVER_V2 in
cfg.CONF.ml2.mechanism_drivers)
except cfg.NoSuchOptError:
return False
示例6: set_admin_creds
# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import NoSuchOptError [as 別名]
def set_admin_creds(cls, config):
cls.admin_user = CONF.auth.admin_username
cls.admin_passwd = CONF.auth.admin_password
# NOTE(toabctl): also allow the old style tempest definition
try:
cls.admin_tenant = CONF.auth.admin_project_name
except cfg.NoSuchOptError:
cls.admin_tenant = CONF.auth.admin_tenant_name
warnings.warn("the config option 'admin_tenant_name' from the "
"'auth' section is deprecated. Please switch "
"to 'admin_project_name'.")
示例7: safe_get
# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import NoSuchOptError [as 別名]
def safe_get(self, value):
try:
return self.__getattr__(value)
except cfg.NoSuchOptError:
return None
示例8: opt_exists
# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import NoSuchOptError [as 別名]
def opt_exists(conf_parent, opt):
try:
return conf_parent[opt]
except cfg.NoSuchOptError:
return False
示例9: metrics_initialize
# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import NoSuchOptError [as 別名]
def metrics_initialize():
"""
Initialize metrics constant
"""
global METRICS
try:
METRICS = get_plugin_instance(PLUGIN_NAMESPACE, cfg.CONF.metrics.driver)
except (NoMatches, MultipleMatches, NoSuchOptError) as error:
raise PluginLoadError('Error loading metrics driver. Check configuration: %s' % error)
return METRICS
示例10: safe_get
# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import NoSuchOptError [as 別名]
def safe_get(self, value):
"""get default group value from CONF
:param value: value.
:return: get default group value from CONF.
"""
try:
return self.__getattr__(value)
except cfg.NoSuchOptError:
return None