當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。