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


Python cfg.BoolOpt方法代码示例

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


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

示例1: injector

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def injector():
    conf = cfg.ConfigOpts()
    conf.register_cli_opts([
        cfg.IntOpt("--measures",
                   help="Measures per metric."),
        cfg.IntOpt("--metrics",
                   help="Number of metrics to create."),
        cfg.IntOpt("--archive-policy-name",
                   help="Name of archive policy to use.",
                   default="low"),
        cfg.IntOpt("--interval",
                   help="Interval to sleep between metrics sending."),
        cfg.BoolOpt("--process", default=False,
                    help="Process the ingested measures."),
    ])
    return _inject(service.prepare_service(conf=conf, log_to_std=True),
                   metrics=conf.metrics,
                   measures=conf.measures,
                   archive_policy_name=conf.archive_policy_name,
                   process=conf.process,
                   interval=conf.interval) 
开发者ID:gnocchixyz,项目名称:gnocchi,代码行数:23,代码来源:injector.py

示例2: __init__

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def __init__(self, config):
        super(EC2Options, self).__init__(config, group="ec2")
        self._options = [
            cfg.StrOpt(
                "metadata_base_url", default="http://169.254.169.254/",
                help="The base URL where the service looks for metadata",
                deprecated_name="ec2_metadata_base_url",
                deprecated_group="DEFAULT"),
            cfg.BoolOpt(
                "add_metadata_private_ip_route", default=True,
                help="Add a route for the metadata ip address to the gateway",
                deprecated_name="ec2_add_metadata_private_ip_route",
                deprecated_group="DEFAULT"),
            cfg.BoolOpt(
                "https_allow_insecure", default=False,
                help="Whether to disable the validation of HTTPS "
                     "certificates."),
            cfg.StrOpt(
                "https_ca_bundle", default=None,
                help="The path to a CA_BUNDLE file or directory with "
                     "certificates of trusted CAs."),
        ] 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:24,代码来源:ec2.py

示例3: __init__

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def __init__(self, config):
        super(OpenStackOptions, self).__init__(config, group="openstack")
        self._options = [
            cfg.StrOpt(
                "metadata_base_url", default="http://169.254.169.254/",
                help="The base URL where the service looks for metadata",
                deprecated_group="DEFAULT"),
            cfg.BoolOpt(
                "add_metadata_private_ip_route", default=True,
                help="Add a route for the metadata ip address to the gateway",
                deprecated_group="DEFAULT"),
            cfg.BoolOpt(
                "https_allow_insecure", default=False,
                help="Whether to disable the validation of HTTPS "
                     "certificates."),
            cfg.StrOpt(
                "https_ca_bundle", default=None,
                help="The path to a CA_BUNDLE file or directory with "
                     "certificates of trusted CAs."),
        ] 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:22,代码来源:openstack.py

示例4: __init__

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def __init__(self, config):
        super(GCEOptions, self).__init__(config, group="gce")
        self._options = [
            cfg.StrOpt(
                "metadata_base_url",
                default="http://metadata.google.internal/computeMetadata/v1/",
                help="The base URL where the service looks for metadata"),
            cfg.BoolOpt(
                "https_allow_insecure", default=False,
                help="Whether to disable the validation of HTTPS "
                     "certificates."),
            cfg.StrOpt(
                "https_ca_bundle", default=None,
                help="The path to a CA_BUNDLE file or directory with "
                     "certificates of trusted CAs."),
        ] 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:18,代码来源:gce.py

示例5: get_plugin_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [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

示例6: list_remote_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def list_remote_opts():
    """Method defining remote URIs for payloads and templates."""
    return [
        cfg.StrOpt(
            "cache_dir",
            default="",
            help=_("Base directory where cached files can be saved")),
        cfg.StrOpt(
            "payloads_uri",
            default=("https://github.com/openstack/syntribos-payloads/"
                     "archive/master.tar.gz"),
            help=_("Remote URI to download payloads.")),
        cfg.StrOpt(
            "templates_uri",
            default=("https://github.com/openstack/"
                     "syntribos-openstack-templates/archive/master.tar.gz"),
            help=_("Remote URI to download templates.")),
        cfg.BoolOpt("enable_cache", default=True,
                    help=_(
                        "Cache remote template & payload resources locally")),
    ] 
开发者ID:openstack-archive,项目名称:syntribos,代码行数:23,代码来源:config.py

示例7: get_base_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def get_base_opts(self):
        _opts = [
            # TODO(aschultz): rename undercloud_output_dir
            cfg.StrOpt('output_dir',
                       default=constants.UNDERCLOUD_OUTPUT_DIR,
                       help=(
                           'Directory to output state, processed heat '
                           'templates, ansible deployment files.'),
                       ),
            cfg.BoolOpt('cleanup',
                        default=True,
                        help=('Cleanup temporary files. Setting this to '
                              'False will leave the temporary files used '
                              'during deployment in place after the command '
                              'is run. This is useful for debugging the '
                              'generated files or if errors occur.'),
                        ),
        ]
        return self.sort_opts(_opts) 
开发者ID:openstack,项目名称:python-tripleoclient,代码行数:21,代码来源:base.py

示例8: test_run_db_purge

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def test_run_db_purge(self, m_purge_cls):
        m_purge = mock.Mock()
        m_purge_cls.return_value = m_purge
        m_purge_cls.get_goal_uuid.return_value = 'Some UUID'
        cfg.CONF.register_opt(cfg.IntOpt("age_in_days"), group="command")
        cfg.CONF.register_opt(cfg.IntOpt("max_number"), group="command")
        cfg.CONF.register_opt(cfg.StrOpt("goal"), group="command")
        cfg.CONF.register_opt(cfg.BoolOpt("exclude_orphans"), group="command")
        cfg.CONF.register_opt(cfg.BoolOpt("dry_run"), group="command")
        cfg.CONF.set_default("age_in_days", None, group="command")
        cfg.CONF.set_default("max_number", None, group="command")
        cfg.CONF.set_default("goal", None, group="command")
        cfg.CONF.set_default("exclude_orphans", True, group="command")
        cfg.CONF.set_default("dry_run", False, group="command")

        dbmanage.DBCommand.purge()

        m_purge_cls.assert_called_once_with(
            None, None, 'Some UUID', True, False)
        m_purge.execute.assert_called_once_with() 
开发者ID:openstack,项目名称:watcher,代码行数:22,代码来源:test_db_manage.py

示例9: test_run_db_purge_negative_max_number

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def test_run_db_purge_negative_max_number(self, m_purge_cls, m_exit):
        m_purge = mock.Mock()
        m_purge_cls.return_value = m_purge
        m_purge_cls.get_goal_uuid.return_value = 'Some UUID'
        cfg.CONF.register_opt(cfg.IntOpt("age_in_days"), group="command")
        cfg.CONF.register_opt(cfg.IntOpt("max_number"), group="command")
        cfg.CONF.register_opt(cfg.StrOpt("goal"), group="command")
        cfg.CONF.register_opt(cfg.BoolOpt("exclude_orphans"), group="command")
        cfg.CONF.register_opt(cfg.BoolOpt("dry_run"), group="command")
        cfg.CONF.set_default("age_in_days", None, group="command")
        cfg.CONF.set_default("max_number", -1, group="command")
        cfg.CONF.set_default("goal", None, group="command")
        cfg.CONF.set_default("exclude_orphans", True, group="command")
        cfg.CONF.set_default("dry_run", False, group="command")

        dbmanage.DBCommand.purge()

        self.assertEqual(0, m_purge_cls.call_count)
        self.assertEqual(0, m_purge.execute.call_count)
        self.assertEqual(0, m_purge.do_delete.call_count)
        self.assertEqual(1, m_exit.call_count) 
开发者ID:openstack,项目名称:watcher,代码行数:23,代码来源:test_db_manage.py

示例10: test_run_db_purge_dry_run

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def test_run_db_purge_dry_run(self, m_purge_cls, m_exit):
        m_purge = mock.Mock()
        m_purge_cls.return_value = m_purge
        m_purge_cls.get_goal_uuid.return_value = 'Some UUID'
        cfg.CONF.register_opt(cfg.IntOpt("age_in_days"), group="command")
        cfg.CONF.register_opt(cfg.IntOpt("max_number"), group="command")
        cfg.CONF.register_opt(cfg.StrOpt("goal"), group="command")
        cfg.CONF.register_opt(cfg.BoolOpt("exclude_orphans"), group="command")
        cfg.CONF.register_opt(cfg.BoolOpt("dry_run"), group="command")
        cfg.CONF.set_default("age_in_days", None, group="command")
        cfg.CONF.set_default("max_number", None, group="command")
        cfg.CONF.set_default("goal", None, group="command")
        cfg.CONF.set_default("exclude_orphans", True, group="command")
        cfg.CONF.set_default("dry_run", True, group="command")

        dbmanage.DBCommand.purge()

        m_purge_cls.assert_called_once_with(
            None, None, 'Some UUID', True, True)
        self.assertEqual(1, m_purge.execute.call_count)
        self.assertEqual(0, m_purge.do_delete.call_count)
        self.assertEqual(0, m_exit.call_count) 
开发者ID:openstack,项目名称:watcher,代码行数:24,代码来源:test_db_manage.py

示例11: _register_app_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def _register_app_opts():
    # Note "allow_origin", "mask_secrets", "heartbeat" options are registered as part of st2common
    # config since they are also used outside st2stream
    api_opts = [
        cfg.StrOpt(
            'host', default='127.0.0.1',
            help='StackStorm stream API server host'),
        cfg.IntOpt(
            'port', default=9102,
            help='StackStorm API stream, server port'),
        cfg.BoolOpt(
            'debug', default=False,
            help='Specify to enable debug mode.'),
        cfg.StrOpt(
            'logging', default='/etc/st2/logging.stream.conf',
            help='location of the logging.conf file')
    ]

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

示例12: _register_action_sensor_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def _register_action_sensor_opts():
    action_sensor_opts = [
        cfg.BoolOpt(
            'enable', default=True,
            help='Whether to enable or disable the ability to post a trigger on action.'),
        cfg.StrOpt(
            'triggers_base_url', default='http://127.0.0.1:9101/v1/triggertypes/',
            help='URL for action sensor to post TriggerType.'),
        cfg.IntOpt(
            'request_timeout', default=1,
            help='Timeout value of all httprequests made by action sensor.'),
        cfg.IntOpt(
            'max_attempts', default=10,
            help='No. of times to retry registration.'),
        cfg.IntOpt(
            'retry_wait', default=1,
            help='Amount of time to wait prior to retrying a request.')
    ]

    _register_opts(action_sensor_opts, group='action_sensor') 
开发者ID:StackStorm,项目名称:st2,代码行数:22,代码来源:config.py

示例13: _register_ssh_runner_opts

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def _register_ssh_runner_opts():
    ssh_runner_opts = [
        cfg.BoolOpt(
            'use_ssh_config', default=False,
            help='Use the .ssh/config file. Useful to override ports etc.'),
        cfg.StrOpt(
            'remote_dir', default='/tmp',
            help='Location of the script on the remote filesystem.'),
        cfg.BoolOpt(
            'allow_partial_failure', default=False,
            help='How partial success of actions run on multiple nodes should be treated.'),
        cfg.IntOpt(
            'max_parallel_actions', default=50,
            help='Max number of parallel remote SSH actions that should be run. '
                 'Works only with Paramiko SSH runner.'),
    ]

    _register_opts(ssh_runner_opts, group='ssh_runner') 
开发者ID:StackStorm,项目名称:st2,代码行数:20,代码来源:config.py

示例14: _parse_config

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def _parse_config():
    cli_opts = [
        cfg.BoolOpt('verbose',
                    short='v',
                    default=False,
                    help='Print more verbose output'),
        cfg.StrOpt('trigger-instance-id',
                   short='t',
                   required=True,
                   dest='trigger_instance_id',
                   help='Id of trigger instance'),
    ]
    CONF.register_cli_opts(cli_opts)
    st2cfg.register_opts(ignore_errors=False)

    CONF(args=sys.argv[1:]) 
开发者ID:StackStorm,项目名称:st2,代码行数:18,代码来源:trigger_re_fire.py

示例15: upgrade

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import BoolOpt [as 别名]
def upgrade():
    conf = cfg.ConfigOpts()
    sack_number_opt = copy.copy(_SACK_NUMBER_OPT)
    sack_number_opt.default = 128
    conf.register_cli_opts([
        cfg.BoolOpt("skip-index", default=False,
                    help="Skip index upgrade."),
        cfg.BoolOpt("skip-storage", default=False,
                    help="Skip storage upgrade."),
        cfg.BoolOpt("skip-incoming", default=False,
                    help="Skip incoming storage upgrade."),
        cfg.BoolOpt("skip-archive-policies-creation", default=False,
                    help="Skip default archive policies creation."),
        sack_number_opt,
    ])
    conf = service.prepare_service(conf=conf, log_to_std=True)
    if not conf.skip_index:
        index = indexer.get_driver(conf)
        LOG.info("Upgrading indexer %s", index)
        index.upgrade()
    if not conf.skip_storage:
        s = storage.get_driver(conf)
        LOG.info("Upgrading storage %s", s)
        s.upgrade()
    if not conf.skip_incoming:
        i = incoming.get_driver(conf)
        LOG.info("Upgrading incoming storage %s", i)
        i.upgrade(conf.sacks_number)

    if (not conf.skip_archive_policies_creation
            and not index.list_archive_policies()
            and not index.list_archive_policy_rules()):
        if conf.skip_index:
            index = indexer.get_driver(conf)
        for name, ap in six.iteritems(archive_policy.DEFAULT_ARCHIVE_POLICIES):
            index.create_archive_policy(ap)
        index.create_archive_policy_rule("default", "*", "low") 
开发者ID:gnocchixyz,项目名称:gnocchi,代码行数:39,代码来源:manage.py


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