Python oslo_config.cfg.NoSuchOptError() Examples

The following are 20 code examples of oslo_config.cfg.NoSuchOptError(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module oslo_config.cfg , or try the search function .
Example #1
Source File: exception.py    From zun with Apache License 2.0 6 votes vote down vote up
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) 
Example #2
Source File: config.py    From magnum with Apache License 2.0 6 votes vote down vote up
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'.") 
Example #3
Source File: exception.py    From magnum with Apache License 2.0 6 votes vote down vote up
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) 
Example #4
Source File: configuration.py    From python-hpedockerplugin with Apache License 2.0 5 votes vote down vote up
def safe_get(self, value):
        try:
            return self.__getattr__(value)
        except cfg.NoSuchOptError:
            return None 
Example #5
Source File: configuration.py    From cyborg with Apache License 2.0 5 votes vote down vote up
def safe_get(self, value):
        """get config_group value from CONF

        :param value: value.
        :return: get config_group value from CONF.
        """

        try:
            return self.__getattr__(value)
        except cfg.NoSuchOptError:
            return None 
Example #6
Source File: configuration.py    From cyborg with Apache License 2.0 5 votes vote down vote up
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 
Example #7
Source File: base.py    From st2 with Apache License 2.0 5 votes vote down vote up
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 
Example #8
Source File: utils.py    From vitrage with Apache License 2.0 5 votes vote down vote up
def opt_exists(conf_parent, opt):
    try:
        return conf_parent[opt]
    except cfg.NoSuchOptError:
        return False 
Example #9
Source File: __init__.py    From vitrage with Apache License 2.0 5 votes vote down vote up
def opt_exists(conf_parent, opt):
    try:
        return conf_parent[opt]
    except cfg.NoSuchOptError:
        return False 
Example #10
Source File: env.py    From dragonflow with Apache License 2.0 5 votes vote down vote up
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']) 
Example #11
Source File: env.py    From networking-bgpvpn with Apache License 2.0 5 votes vote down vote up
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']) 
Example #12
Source File: configuration.py    From manila with Apache License 2.0 5 votes vote down vote up
def safe_get(self, value):
        try:
            return self.__getattr__(value)
        except cfg.NoSuchOptError:
            return None 
Example #13
Source File: config.py    From magnum with Apache License 2.0 5 votes vote down vote up
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'.") 
Example #14
Source File: env.py    From networking-midonet with Apache License 2.0 5 votes vote down vote up
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']) 
Example #15
Source File: env.py    From networking-odl with Apache License 2.0 5 votes vote down vote up
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']) 
Example #16
Source File: trunk_driver_v2.py    From networking-odl with Apache License 2.0 5 votes vote down vote up
def is_loaded(self):
        try:
            return (odl_const.ODL_ML2_MECH_DRIVER_V2 in
                    cfg.CONF.ml2.mechanism_drivers)
        except cfg.NoSuchOptError:
            return False 
Example #17
Source File: env.py    From networking-l2gw with Apache License 2.0 5 votes vote down vote up
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']) 
Example #18
Source File: env.py    From neutron-dynamic-routing with Apache License 2.0 5 votes vote down vote up
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']) 
Example #19
Source File: env.py    From neutron-vpnaas with Apache License 2.0 5 votes vote down vote up
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']) 
Example #20
Source File: env.py    From networking-sfc with Apache License 2.0 5 votes vote down vote up
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'])