当前位置: 首页>>代码示例>>Python>>正文


Python cfg.NoSuchOptError方法代码示例

本文整理汇总了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) 
开发者ID:openstack,项目名称:zun,代码行数:26,代码来源:exception.py

示例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'.") 
开发者ID:openstack,项目名称:magnum,代码行数:19,代码来源:config.py

示例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) 
开发者ID:openstack,项目名称:magnum,代码行数:27,代码来源:exception.py

示例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']) 
开发者ID:openstack,项目名称:networking-sfc,代码行数:11,代码来源:env.py

示例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 
开发者ID:openstack,项目名称:networking-odl,代码行数:8,代码来源:trunk_driver_v2.py

示例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'.") 
开发者ID:openstack,项目名称:magnum,代码行数:13,代码来源:config.py

示例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 
开发者ID:openstack,项目名称:manila,代码行数:7,代码来源:configuration.py

示例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 
开发者ID:openstack,项目名称:vitrage,代码行数:7,代码来源:__init__.py

示例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 
开发者ID:StackStorm,项目名称:st2,代码行数:14,代码来源:base.py

示例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 
开发者ID:openstack,项目名称:cyborg,代码行数:12,代码来源:configuration.py


注:本文中的oslo_config.cfg.NoSuchOptError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。