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


Python cfg.StrOpt方法代码示例

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


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

示例1: __init__

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

示例2: setup_conf

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

示例3: __init__

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import StrOpt [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 StrOpt [as 别名]
def __init__(self, config):
        super(OvfOptions, self).__init__(config, group="ovf")
        self._options = [
            cfg.StrOpt(
                "config_file_name",
                default="ovf-env.xml",
                help="Configuration file name"),
            cfg.StrOpt(
                "drive_label",
                default="OVF ENV",
                help="Look for configuration file in drives with this label"),
            cfg.StrOpt(
                "ns",
                default="oe",
                help="Namespace prefix for ovf environment"),
        ] 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:18,代码来源:ovf.py

示例5: __init__

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import StrOpt [as 别名]
def __init__(self, config):
        super(CloudStackOptions, self).__init__(config, group="cloudstack")
        self._options = [
            cfg.StrOpt(
                "metadata_base_url", default="http://10.1.1.1/",
                help="The base URL where the service looks for metadata",
                deprecated_name="cloudstack_metadata_ip",
                deprecated_group="DEFAULT"),
            cfg.IntOpt(
                "password_server_port", default=8080,
                help="The port number used by the Password Server."
            ),
            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."),
            cfg.BoolOpt(
                "add_metadata_private_ip_route", default=False,
                help="Add a route for the metadata ip address to the gateway"),
        ] 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:26,代码来源:cloudstack.py

示例6: __init__

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

示例7: get_plugin_opts

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

示例8: setup

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

示例9: list_remote_opts

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

示例10: _set_conf

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import StrOpt [as 别名]
def _set_conf(self, sub_dir=None):
        default_dir = utils.get_resources_dir() + \
            '/static_datasources' + (sub_dir if sub_dir else '')

        opts = [
            cfg.StrOpt(DSOpts.TRANSFORMER,
                       default='vitrage.datasources.static.transformer.'
                               'StaticTransformer'),
            cfg.StrOpt(DSOpts.DRIVER,
                       default='vitrage.datasources.static.driver.'
                               'StaticDriver'),
            cfg.IntOpt(DSOpts.CHANGES_INTERVAL,
                       default=30,
                       min=30,
                       help='interval between checking changes in the static '
                            'datasources'),
            cfg.StrOpt('directory', default=default_dir),
        ]

        self.conf_reregister_opts(opts, group=STATIC_DATASOURCE) 
开发者ID:openstack,项目名称:vitrage,代码行数:22,代码来源:test_static_driver.py

示例11: _validate_deprecetad_now_invalid_parameters

# 需要导入模块: from oslo_config import cfg [as 别名]
# 或者: from oslo_config.cfg import StrOpt [as 别名]
def _validate_deprecetad_now_invalid_parameters():
    invalid_opts = [
        'masquerade_network',
    ]
    deprecate_conf = cfg.CONF
    invalid_opts_used = []

    for invalid_opt in invalid_opts:
        deprecate_conf.register_opts([cfg.StrOpt(invalid_opt)])
        if deprecate_conf.get(invalid_opt):
            invalid_opts_used.append(invalid_opt)
    if invalid_opts_used:
        msg = _('Options that has been deprecated and removed/replaced '
                'detected. Invalid options: %s') % invalid_opts_used
        LOG.error(msg)
        raise FailedValidation(msg)
    del deprecate_conf 
开发者ID:openstack,项目名称:python-tripleoclient,代码行数:19,代码来源:undercloud_preflight.py

示例12: get_base_opts

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

示例13: test_run_db_purge

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

示例14: test_run_db_purge_negative_max_number

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

示例15: test_run_db_purge_dry_run

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


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