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


Python cfg.ListOpt方法代码示例

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


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

示例1: setup_conf

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def setup_conf():
    cli_opts = [
        cfg.DictOpt('mount_paths',
                    required=True,
                    help=_('Dict of paths to bind-mount (source:target) '
                           'prior to launch subprocess.')),
        cfg.ListOpt(
            'cmd',
            required=True,
            help=_('Command line to execute as a subprocess '
                   'provided as comma-separated list of arguments.')),
        cfg.StrOpt('rootwrap_config', default='/etc/neutron/rootwrap.conf',
                   help=_('Rootwrap configuration file.')),
    ]
    conf = cfg.CONF
    conf.register_cli_opts(cli_opts)
    return conf 
开发者ID:openstack,项目名称:neutron-vpnaas,代码行数:19,代码来源:netns_wrapper.py

示例2: get_plugin_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def get_plugin_opts(cls):
        """Options that can be overridden per plugin.
        """
        opts = [
            cfg.StrOpt("resource_group_name"),
            cfg.BoolOpt("enabled", default=cls.is_plugin_enabled_by_default()),
            cfg.StrOpt("admin_only_fields"),
            cfg.BoolOpt('mapping_use_doc_values'),
            cfg.ListOpt('override_region_name',
                        help="Override the region name configured in "
                             "'service_credentials'. This is useful when a "
                             "service is deployed as a cloud-wide service "
                             "rather than per region (e.g. Region1,Region2)."),
            cfg.ListOpt('publishers',
                        help='Used to configure publishers for the plugin, '
                             'value could be publisher names configured in '
                             'setup.cfg file.'
                        )
        ]
        if cls.NotificationHandlerCls:
            opts.extend(cls.NotificationHandlerCls.get_plugin_opts())
        return opts 
开发者ID:openstack,项目名称:searchlight,代码行数:24,代码来源:base.py

示例3: list_test_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def list_test_opts():
    return [
        cfg.FloatOpt("length_diff_percent", default=1000.0,
                     help=_(
                         "Percentage difference between initial request "
                         "and test request body length to trigger a signal")),
        cfg.FloatOpt("time_diff_percent", default=1000.0,
                     help=_(
                         "Percentage difference between initial response "
                         "time and test response time to trigger a signal")),
        cfg.IntOpt("max_time", default=10,
                   help=_(
                       "Maximum absolute time (in seconds) to wait for a "
                       "response before triggering a timeout signal")),
        cfg.IntOpt("max_length", default=500,
                   help=_(
                       "Maximum length (in characters) of the response text")),
        cfg.ListOpt("failure_keys", default="[`syntax error`]",
                    help=_(
                        "Comma seperated list of keys for which the test "
                        "would fail."))
    ] 
开发者ID:openstack-archive,项目名称:syntribos,代码行数:24,代码来源:config.py

示例4: get_config_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def get_config_opts(cls):
        """Defines the configuration options to be associated to this loadable

        :return: A list of configuration options relative to this Loadable
        :rtype: list of :class:`oslo_config.cfg.Opt` instances
        """

        datasources_ops = list(ds_manager.DataSourceManager.metric_map.keys())

        return [
            cfg.ListOpt(
                "datasources",
                help="Datasources to use in order to query the needed metrics."
                     " This option overrides the global preference."
                     " options: {0}".format(datasources_ops),
                item_type=cfg.types.String(choices=datasources_ops),
                default=None)
        ] 
开发者ID:openstack,项目名称:watcher,代码行数:20,代码来源:base.py

示例5: _print_options

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def _print_options(opt_group, options):
    for opt in options:
        opt = opt['opt']

        # Special case for options which could change during this script run
        static_option_value = STATIC_OPTION_VALUES.get(opt_group.name, {}).get(opt.name, None)
        if static_option_value:
            opt.default = static_option_value

        # Special handling for list options
        if isinstance(opt, cfg.ListOpt):
            if opt.default:
                value = ','.join(opt.default)
            else:
                value = ''

            value += ' # comma separated list allowed here.'
        else:
            value = opt.default

        print('# %s' % opt.help)
        print('%s = %s' % (opt.name, value)) 
开发者ID:StackStorm,项目名称:st2,代码行数:24,代码来源:config_gen.py

示例6: setUp

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def setUp(self):
        super(TestHealthCheck, self).setUp()

        # We need to define these early as they are late loaded in oslo
        # middleware and our configuration overrides would not apply.
        # Note: These must match exactly the option definitions in
        # oslo.middleware healthcheck! If not you will get duplicate option
        # errors.
        healthcheck_opts = [
            cfg.BoolOpt(
                'detailed', default=False,
                help='Show more detailed information as part of the response. '
                     'Security note: Enabling this option may expose '
                     'sensitive details about the service being monitored. '
                     'Be sure to verify that it will not violate your '
                     'security policies.'),
            cfg.ListOpt(
                'backends', default=[],
                help='Additional backends that can perform health checks and '
                     'report that information back as part of a request.'),
        ]
        cfg.CONF.register_opts(healthcheck_opts, group='healthcheck')

        self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
        self.conf.config(group='healthcheck', backends=['octavia_db_check'])
        self.UNAVAILABLE = (healthcheck_plugins.OctaviaDBHealthcheck.
                            UNAVAILABLE_REASON)

        def reset_pecan():
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan) 
开发者ID:openstack,项目名称:octavia,代码行数:34,代码来源:test_healthcheck.py

示例7: __init__

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def __init__(self, config):
        super(CloudConfigOptions, self).__init__(config, group="config_drive")
        self._options = [
            cfg.BoolOpt(
                "raw_hdd", default=True,
                help="Look for an ISO config drive in raw HDDs",
                deprecated_name="config_drive_raw_hhd",
                deprecated_group="DEFAULT",
                deprecated_for_removal=True),
            cfg.BoolOpt(
                "cdrom", default=True,
                help="Look for a config drive in the attached cdrom drives",
                deprecated_name="config_drive_cdrom",
                deprecated_group="DEFAULT",
                deprecated_for_removal=True),
            cfg.BoolOpt(
                "vfat", default=True,
                help="Look for a config drive in VFAT filesystems",
                deprecated_name="config_drive_vfat",
                deprecated_group="DEFAULT",
                deprecated_for_removal=True),
            cfg.ListOpt(
                "types", default=list(constant.CD_TYPES),
                help="Supported formats of a configuration drive",
                deprecated_name="config_drive_types",
                deprecated_group="DEFAULT",),
            cfg.ListOpt(
                "locations", default=list(constant.CD_LOCATIONS),
                deprecated_name="config_drive_locations",
                deprecated_group="DEFAULT",
                help="Supported configuration drive locations"),
        ] 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:34,代码来源:cloudconfig.py

示例8: setUp

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def setUp(self):
        super(TestBaseNetworkSettings, self).setUp()
        self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
        # don't actually load config from ~/undercloud.conf
        self.mock_config_load = self.useFixture(
            fixtures.MockPatch('tripleoclient.utils.load_config'))
        self.conf.config(local_ip='192.168.24.1/24',
                         undercloud_admin_host='192.168.24.3',
                         undercloud_public_host='192.168.24.2',
                         undercloud_nameservers=['10.10.10.10', '10.10.10.11'])
        # ctlplane network - config group options
        self.grp0 = cfg.OptGroup(name='ctlplane-subnet',
                                 title='ctlplane-subnet')
        self.opts = [cfg.StrOpt('cidr'),
                     cfg.ListOpt('dhcp_start'),
                     cfg.ListOpt('dhcp_end'),
                     cfg.ListOpt('dhcp_exclude'),
                     cfg.StrOpt('inspection_iprange'),
                     cfg.StrOpt('gateway'),
                     cfg.BoolOpt('masquerade'),
                     cfg.ListOpt('host_routes',
                                 item_type=cfg.types.Dict(bounds=True),
                                 bounds=True,),
                     cfg.ListOpt('dns_nameservers')]
        self.conf.register_opts(self.opts, group=self.grp0)
        self.grp1 = cfg.OptGroup(name='subnet1', title='subnet1')
        self.grp2 = cfg.OptGroup(name='subnet2', title='subnet2')
        self.conf.config(cidr='192.168.24.0/24',
                         dhcp_start='192.168.24.5',
                         dhcp_end='192.168.24.24',
                         dhcp_exclude=[],
                         inspection_iprange='192.168.24.100,192.168.24.120',
                         gateway='192.168.24.1',
                         masquerade=False,
                         host_routes=[],
                         dns_nameservers=[],
                         group='ctlplane-subnet') 
开发者ID:openstack,项目名称:python-tripleoclient,代码行数:39,代码来源:test_config.py

示例9: get_local_subnet_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def get_local_subnet_opts(self):
        _subnets_opts = [
            cfg.StrOpt('cidr',
                       default=constants.CTLPLANE_CIDR_DEFAULT,
                       deprecated_opts=_deprecated_opt_network_cidr,
                       help=CIDR_HELP_STR),
            cfg.ListOpt('dhcp_start',
                        default=constants.CTLPLANE_DHCP_START_DEFAULT,
                        deprecated_opts=_deprecated_opt_dhcp_start,
                        help=DHCP_START_HELP_STR),
            cfg.ListOpt('dhcp_end',
                        default=constants.CTLPLANE_DHCP_END_DEFAULT,
                        deprecated_opts=_deprecated_opt_dhcp_end,
                        help=DHCP_END_HELP_STR),
            cfg.ListOpt('dhcp_exclude',
                        default=[],
                        help=DHCP_EXCLUDE_HELP_STR),
            cfg.StrOpt('inspection_iprange',
                       default=constants.CTLPLANE_INSPECTION_IPRANGE_DEFAULT,
                       deprecated_opts=_deprecated_opt_inspection_iprange,
                       help=INSPECTION_IPRANGE_HELP_STR),
            cfg.StrOpt('gateway',
                       default=constants.CTLPLANE_GATEWAY_DEFAULT,
                       deprecated_opts=_deprecated_opt_network_gateway,
                       help=GATEWAY_HELP_STR),
            cfg.BoolOpt('masquerade',
                        default=False,
                        help=MASQUERADE_HELP_STR),
            cfg.ListOpt('host_routes',
                        item_type=cfg.types.Dict(bounds=True),
                        bounds=True,
                        default=[],
                        sample_default=('[{destination: 10.10.10.0/24, '
                                        'nexthop: 192.168.24.1}]'),
                        help=HOST_ROUTES_HELP_STR),
            cfg.ListOpt('dns_nameservers',
                        default=constants.CTLPLANE_DNS_NAMESERVERS_DEFAULT,
                        help=DNS_NAMESERVERS_HELP_STR),
        ]
        return self.sort_opts(_subnets_opts) 
开发者ID:openstack,项目名称:python-tripleoclient,代码行数:42,代码来源:undercloud.py

示例10: get_remote_subnet_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def get_remote_subnet_opts(self):
        _subnets_opts = [
            cfg.StrOpt('cidr',
                       help=CIDR_HELP_STR),
            cfg.ListOpt('dhcp_start',
                        default=[],
                        help=DHCP_START_HELP_STR),
            cfg.ListOpt('dhcp_end',
                        default=[],
                        help=DHCP_END_HELP_STR),
            cfg.ListOpt('dhcp_exclude',
                        default=[],
                        help=DHCP_EXCLUDE_HELP_STR),
            cfg.StrOpt('inspection_iprange',
                       help=INSPECTION_IPRANGE_HELP_STR),
            cfg.StrOpt('gateway',
                       help=GATEWAY_HELP_STR),
            cfg.BoolOpt('masquerade',
                        default=False,
                        help=MASQUERADE_HELP_STR),
            cfg.ListOpt('host_routes',
                        item_type=cfg.types.Dict(bounds=True),
                        bounds=True,
                        default=[],
                        help=HOST_ROUTES_HELP_STR),
            cfg.ListOpt('dns_nameservers',
                        default=constants.CTLPLANE_DNS_NAMESERVERS_DEFAULT,
                        help=DNS_NAMESERVERS_HELP_STR),
        ]
        return self.sort_opts(_subnets_opts) 
开发者ID:openstack,项目名称:python-tripleoclient,代码行数:32,代码来源:undercloud.py

示例11: get_config_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def get_config_opts(cls):
        return super(StorageCapacityBalance, cls).get_config_opts() + [
            cfg.ListOpt(
                "ex_pools",
                help="exclude pools",
                default=['local_vstorage']),
        ] 
开发者ID:openstack,项目名称:watcher,代码行数:9,代码来源:storage_capacity_balance.py

示例12: _register_app_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def _register_app_opts():
    # Note "host", "port", "allow_origin", "mask_secrets" options are registered as part of
    # st2common config since they are also used outside st2api
    static_root = os.path.join(cfg.CONF.system.base_path, 'static')
    template_path = os.path.join(BASE_DIR, 'templates/')

    pecan_opts = [
        cfg.StrOpt(
            'root', default='st2api.controllers.root.RootController',
            help='Action root controller'),
        cfg.StrOpt('static_root', default=static_root),
        cfg.StrOpt('template_path', default=template_path),
        cfg.ListOpt('modules', default=['st2api']),
        cfg.BoolOpt('debug', default=False),
        cfg.BoolOpt('auth_enable', default=True),
        cfg.DictOpt('errors', default={'__force_dict__': True})
    ]

    CONF.register_opts(pecan_opts, group='api_pecan')

    logging_opts = [
        cfg.BoolOpt('debug', default=False),
        cfg.StrOpt(
            'logging', default='/etc/st2/logging.api.conf',
            help='location of the logging.conf file'),
        cfg.IntOpt(
            'max_page_size', default=100,
            help='Maximum limit (page size) argument which can be '
                 'specified by the user in a query string.')
    ]

    CONF.register_opts(logging_opts, group='api') 
开发者ID:StackStorm,项目名称:st2,代码行数:34,代码来源:config.py

示例13: main

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import ListOpt [as 别名]
def main():
    monkey_patch()

    cli_opts = [
        cfg.IntOpt('rate', default=100,
                   help='Rate of trigger injection measured in instances in per sec.' +
                   ' Assumes a default exponential distribution in time so arrival is poisson.'),
        cfg.ListOpt('triggers', required=False,
                    help='List of triggers for which instances should be fired.' +
                    ' Uniform distribution will be followed if there is more than one' +
                    'trigger.'),
        cfg.StrOpt('schema_file', default=None,
                   help='Path to schema file defining trigger and payload.'),
        cfg.IntOpt('duration', default=60,
                   help='Duration of stress test in seconds.'),
        cfg.BoolOpt('max-throughput', default=False,
                   help='If True, "rate" argument will be ignored and this script will try to '
                   'saturize the CPU and achieve max utilization.')
    ]
    do_register_cli_opts(cli_opts)
    config.parse_args()

    # Get config values
    triggers = cfg.CONF.triggers
    trigger_payload_schema = {}

    if not triggers:
        if (cfg.CONF.schema_file is None or cfg.CONF.schema_file == '' or
                not os.path.exists(cfg.CONF.schema_file)):
            print('Either "triggers" need to be provided or a schema file containing' +
                  ' triggers should be provided.')
            return
        with open(cfg.CONF.schema_file) as fd:
            trigger_payload_schema = yaml.safe_load(fd)
            triggers = list(trigger_payload_schema.keys())
            print('Triggers=%s' % triggers)

    rate = cfg.CONF.rate
    rate_per_trigger = int(rate / len(triggers))
    duration = cfg.CONF.duration
    max_throughput = cfg.CONF.max_throughput

    if max_throughput:
        rate = 0
        rate_per_trigger = 0

    dispatcher_pool = eventlet.GreenPool(len(triggers))

    for trigger in triggers:
        payload = trigger_payload_schema.get(trigger, {})
        dispatcher_pool.spawn(_inject_instances, trigger, rate_per_trigger, duration,
                              payload=payload, max_throughput=max_throughput)
        eventlet.sleep(random.uniform(0, 1))
    dispatcher_pool.waitall() 
开发者ID:StackStorm,项目名称:st2,代码行数:56,代码来源:st2-inject-trigger-instances.py


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