當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。