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


Python cfg.OptGroup方法代码示例

本文整理汇总了Python中oslo_config.cfg.OptGroup方法的典型用法代码示例。如果您正苦于以下问题:Python cfg.OptGroup方法的具体用法?Python cfg.OptGroup怎么用?Python cfg.OptGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oslo_config.cfg的用法示例。


在下文中一共展示了cfg.OptGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_parent_port_by_host_ip

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def _get_parent_port_by_host_ip(self, node_fixed_ip):
        os_net = clients.get_network_client()
        node_subnet_id = oslo_cfg.CONF.pod_vif_nested.worker_nodes_subnet
        if not node_subnet_id:
            raise oslo_cfg.RequiredOptError(
                'worker_nodes_subnet', oslo_cfg.OptGroup('pod_vif_nested'))

        try:
            fixed_ips = ['subnet_id=%s' % str(node_subnet_id),
                         'ip_address=%s' % str(node_fixed_ip)]
            ports = os_net.ports(fixed_ips=fixed_ips)
        except os_exc.SDKException:
            LOG.error("Parent vm port with fixed ips %s not found!",
                      fixed_ips)
            raise

        try:
            return next(ports)
        except StopIteration:
            LOG.error("Neutron port for vm port with fixed ips %s not found!",
                      fixed_ips)
            raise kl_exc.NoResourceException 
开发者ID:openstack,项目名称:kuryr-kubernetes,代码行数:24,代码来源:nested_vif.py

示例2: parse_args

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def parse_args(args=[]):
    CONF.register_cli_opts(api_common_opts())
    register_db_drivers_opt()
    # register paste configuration
    paste_grp = cfg.OptGroup('paste_deploy',
                             'Paste Configuration')
    CONF.register_group(paste_grp)
    CONF.register_opts(paste_deploy, group=paste_grp)
    log.register_options(CONF)
    policy.Enforcer(CONF)
    default_config_files = cfg.find_config_files('freezer', 'freezer-api')
    CONF(args=args,
         project='freezer-api',
         default_config_files=default_config_files,
         version=FREEZER_API_VERSION
         ) 
开发者ID:openstack,项目名称:freezer-api,代码行数:18,代码来源:config.py

示例3: setup

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def setup(disable_keystone=False):
    cfg.CONF([], project='promenade')
    cfg.CONF.register_opts(OPTIONS)
    log_group = cfg.OptGroup(name='logging', title='Logging options')
    cfg.CONF.register_group(log_group)
    logging_options = [
        cfg.StrOpt(
            'log_level',
            choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'],
            default='DEBUG',
            help='Global log level for PROMENADE')
    ]
    cfg.CONF.register_opts(logging_options, group=log_group)
    if disable_keystone is False:
        cfg.CONF.register_opts(
            keystoneauth1.loading.get_auth_plugin_conf_options('password'),
            group='keystone_authtoken') 
开发者ID:airshipit,项目名称:promenade,代码行数:19,代码来源:options.py

示例4: get_test_cases

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def get_test_cases(cls, filename, file_content, meta_vars):
        """Generates the test cases

        For this particular test, only a single test
        is created (in addition to the base case, that is)
        """
        alt_user_group = cfg.OptGroup(name="alt_user",
                                      title="Alt Keystone User Config")
        CONF.register_group(alt_user_group)
        CONF.register_opts(syntribos.config.list_user_opts(),
                           group=alt_user_group)

        alt_user_id = CONF.alt_user.user_id
        alt_user_username = CONF.alt_user.username
        if not alt_user_id or not alt_user_username:
            return

        yield cls 
开发者ID:openstack-archive,项目名称:syntribos,代码行数:20,代码来源:auth.py

示例5: setUp

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def setUp(self):
        super(TestListOpts, self).setUp()
        # These option groups will be registered using strings instead of
        # OptGroup objects this should be avoided if possible.
        self.none_objects = ['DEFAULT', 'watcher_clients_auth',
                             'watcher_strategies.strategy_1']

        self.base_sections = [
            'DEFAULT', 'api', 'database', 'watcher_decision_engine',
            'watcher_applier', 'watcher_datasources', 'watcher_planner',
            'nova_client', 'glance_client', 'gnocchi_client', 'grafana_client',
            'grafana_translators', 'cinder_client', 'ceilometer_client',
            'monasca_client', 'ironic_client', 'keystone_client',
            'neutron_client', 'watcher_clients_auth', 'collector',
            'placement_client']
        self.opt_sections = list(dict(opts.list_opts()).keys()) 
开发者ID:openstack,项目名称:watcher,代码行数:18,代码来源:test_list_opts.py

示例6: _assert_name_or_group

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def _assert_name_or_group(self, actual_sections, expected_sections):
        for name_or_group, options in actual_sections:
            section_name = name_or_group
            if isinstance(name_or_group, cfg.OptGroup):
                section_name = name_or_group.name
            elif section_name in self.none_objects:
                pass
            else:
                # All option groups should be added to list_otps with an
                # OptGroup object for some exceptions this is not possible but
                # new groups should use OptGroup
                raise Exception(
                    "Invalid option group: {0} should be of type OptGroup not "
                    "string.".format(section_name))

        self.assertIn(section_name, expected_sections)
        self.assertTrue(len(options)) 
开发者ID:openstack,项目名称:watcher,代码行数:19,代码来源:test_list_opts.py

示例7: load

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def load(cls, plugin_name):
        """
        Load a plugin, registering its configuration options

        :param plugin_name: the name of the plugin extension

        :returns: an initialized instance of the class
        """
        cfg_group_name = "os_vif_" + plugin_name
        cfg_opts = getattr(cls, "CONFIG_OPTS")
        cfg_vals = None
        if cfg_opts and len(cfg_opts) > 0:
            cfg_group = cfg.OptGroup(
                cfg_group_name,
                "os-vif plugin %s options" % plugin_name)
            CONF.register_opts(cfg_opts, group=cfg_group)

            cfg_vals = getattr(CONF, cfg_group_name)
        return cls(cfg_vals) 
开发者ID:openstack,项目名称:os-vif,代码行数:21,代码来源:plugin.py

示例8: setUp

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def setUp(self):
        super(BaseOVSTest, self).setUp()
        test_vif_plug_ovs_group = cfg.OptGroup('test_vif_plug_ovs')
        CONF.register_group(test_vif_plug_ovs_group)
        CONF.register_opt(cfg.IntOpt('ovs_vsctl_timeout', default=1500),
                          test_vif_plug_ovs_group)
        CONF.register_opt(cfg.StrOpt('ovsdb_interface', default='vsctl'),
                          test_vif_plug_ovs_group)
        CONF.register_opt(cfg.StrOpt('ovsdb_connection', default=None),
                          test_vif_plug_ovs_group)
        self.br = ovsdb_lib.BaseOVS(cfg.CONF.test_vif_plug_ovs)
        self.mock_db_set = mock.patch.object(self.br.ovsdb, 'db_set').start()
        self.mock_del_port = mock.patch.object(self.br.ovsdb,
                                               'del_port').start()
        self.mock_add_port = mock.patch.object(self.br.ovsdb,
                                               'add_port').start()
        self.mock_add_br = mock.patch.object(self.br.ovsdb, 'add_br').start()
        self.mock_transaction = mock.patch.object(self.br.ovsdb,
                                                  'transaction').start() 
开发者ID:openstack,项目名称:os-vif,代码行数:21,代码来源:test_ovsdb_lib.py

示例9: start

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def start():
    conf = service.prepare_service()

    if conf.statsd.resource_id is None:
        raise cfg.RequiredOptError("resource_id", cfg.OptGroup("statsd"))

    stats = Stats(conf)

    loop = asyncio.get_event_loop()
    # TODO(jd) Add TCP support
    listen = loop.create_datagram_endpoint(
        lambda: StatsdServer(stats),
        local_addr=(conf.statsd.host, conf.statsd.port))

    def _flush():
        loop.call_later(conf.statsd.flush_delay, _flush)
        stats.flush()

    loop.call_later(conf.statsd.flush_delay, _flush)
    transport, protocol = loop.run_until_complete(listen)

    LOG.info("Started on %s:%d", conf.statsd.host, conf.statsd.port)
    LOG.info("Flush delay: %d seconds", conf.statsd.flush_delay)

    try:
        loop.run_forever()
    except KeyboardInterrupt:
        pass

    transport.close()
    loop.close() 
开发者ID:gnocchixyz,项目名称:gnocchi,代码行数:33,代码来源:statsd.py

示例10: test_list_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def test_list_opts(self):
        for group, opt_list in opts.list_opts():
            if isinstance(group, str):
                self.assertEqual('DEFAULT', group)
            else:
                self.assertIsInstance(group, cfg.OptGroup)
            for opt in opt_list:
                self.assertIsInstance(opt, cfg.Opt) 
开发者ID:openstack,项目名称:zun,代码行数:10,代码来源:test_conf.py

示例11: list_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def list_opts():
    group_name, ssl_opts = sslutils.list_opts()[0]
    ssl_group = cfg.OptGroup(name=group_name,
                             title='Options for the ssl')
    return {
        ssl_group: ssl_opts
    } 
开发者ID:openstack,项目名称:zun,代码行数:9,代码来源:ssl.py

示例12: get_project

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def get_project(self, pod):
        project_id = config.CONF.neutron_defaults.project

        if not project_id:
            # NOTE(ivc): this option is only required for
            # DefaultPodProjectDriver and its subclasses, but it may be
            # optional for other drivers (e.g. when each namespace has own
            # project)
            raise cfg.RequiredOptError('project',
                                       cfg.OptGroup('neutron_defaults'))

        return project_id 
开发者ID:openstack,项目名称:kuryr-kubernetes,代码行数:14,代码来源:default_project.py

示例13: get_subnets

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def get_subnets(self, pod, project_id):
        subnet_id = config.CONF.neutron_defaults.pod_subnet

        if not subnet_id:
            # NOTE(ivc): this option is only required for
            # DefaultPodSubnetDriver and its subclasses, but it may be
            # optional for other drivers (e.g. when each namespace has own
            # subnet)
            raise cfg.RequiredOptError('pod_subnet',
                                       cfg.OptGroup('neutron_defaults'))

        return {subnet_id: utils.get_subnet(subnet_id)} 
开发者ID:openstack,项目名称:kuryr-kubernetes,代码行数:14,代码来源:default_subnet.py

示例14: get_security_groups

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def get_security_groups(self, pod, project_id):
        sg_list = config.CONF.neutron_defaults.pod_security_groups

        if not sg_list:
            # NOTE(ivc): this option is only required for
            # Default{Pod,Service}SecurityGroupsDriver and its subclasses,
            # but it may be optional for other drivers (e.g. when each
            # namespace has own set of security groups)
            raise cfg.RequiredOptError('pod_security_groups',
                                       cfg.OptGroup('neutron_defaults'))

        return sg_list[:] 
开发者ID:openstack,项目名称:kuryr-kubernetes,代码行数:14,代码来源:default_security_groups.py

示例15: __init__

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import OptGroup [as 别名]
def __init__(self, backend, is_created=False):
        if not is_created:
            grp = cfg.OptGroup(backend)
            CONF.register_group(grp)
            CONF.register_opts(self._OPTS, grp)
        self.conf = CONF.get(backend)
        self.backend = backend 
开发者ID:openstack,项目名称:freezer-api,代码行数:9,代码来源:base.py


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