當前位置: 首頁>>代碼示例>>Python>>正文


Python cfg.IntOpt方法代碼示例

本文整理匯總了Python中oslo_config.cfg.IntOpt方法的典型用法代碼示例。如果您正苦於以下問題:Python cfg.IntOpt方法的具體用法?Python cfg.IntOpt怎麽用?Python cfg.IntOpt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在oslo_config.cfg的用法示例。


在下文中一共展示了cfg.IntOpt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: injector

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [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 IntOpt [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

示例3: list_test_opts

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [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: _set_conf

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [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

示例5: get_config_opts

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [as 別名]
def get_config_opts(cls):
        return [
            cfg.IntOpt(
                'max_workers',
                default=processutils.get_worker_count(),
                min=1,
                required=True,
                help='Number of workers for taskflow engine '
                     'to execute actions.'),
            cfg.DictOpt(
                'action_execution_rule',
                default={},
                help='The execution rule for linked actions,'
                     'the key is strategy name and '
                     'value ALWAYS means all actions will be executed,'
                     'value ANY means if previous action executes '
                     'success, the next action will be ignored.'
                     'None means ALWAYS.')
            ] 
開發者ID:openstack,項目名稱:watcher,代碼行數:21,代碼來源:default.py

示例6: test_run_db_purge

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [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

示例7: test_run_db_purge_negative_max_number

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [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

示例8: test_run_db_purge_dry_run

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [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

示例9: _register_app_opts

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [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

示例10: _register_action_sensor_opts

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [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

示例11: _register_ssh_runner_opts

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [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

示例12: setUp

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [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

示例13: metricd

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [as 別名]
def metricd():
    conf = cfg.ConfigOpts()
    conf.register_cli_opts([
        cfg.IntOpt("stop-after-processing-metrics",
                   default=0,
                   min=0,
                   help="Number of metrics to process without workers, "
                   "for testing purpose"),
    ])
    conf = service.prepare_service(conf=conf)

    if conf.stop_after_processing_metrics:
        metricd_tester(conf)
    else:
        MetricdServiceManager(conf).run() 
開發者ID:gnocchixyz,項目名稱:gnocchi,代碼行數:17,代碼來源:metricd.py

示例14: injector

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [as 別名]
def injector():
    conf = cfg.ConfigOpts()
    conf.register_cli_opts([
        cfg.IntOpt("metrics", default=1, min=1),
        cfg.StrOpt("archive-policy-name", default="low"),
        cfg.StrOpt("creator", default="admin"),
        cfg.IntOpt("batch-of-measures", default=1000),
        cfg.IntOpt("measures-per-batch", default=10),
    ])
    conf = service.prepare_service(conf=conf)
    index = indexer.get_driver(conf)
    instore = incoming.get_driver(conf)

    def todo():
        metric = index.create_metric(
            uuid.uuid4(),
            creator=conf.creator,
            archive_policy_name=conf.archive_policy_name)

        for _ in six.moves.range(conf.batch_of_measures):
            measures = [
                incoming.Measure(
                    utils.dt_in_unix_ns(utils.utcnow()), random.random())
                for __ in six.moves.range(conf.measures_per_batch)]
            instore.add_measures(metric, measures)

    with futures.ThreadPoolExecutor(max_workers=conf.metrics) as executor:
        for m in six.moves.range(conf.metrics):
            executor.submit(todo) 
開發者ID:gnocchixyz,項目名稱:gnocchi,代碼行數:31,代碼來源:measures_injector.py

示例15: get_cfg_opts

# 需要導入模塊: from oslo_config import cfg [as 別名]
# 或者: from oslo_config.cfg import IntOpt [as 別名]
def get_cfg_opts(cls):
        group = cfg.OptGroup(
            name='backend:ipa', title="Configuration for IPA Backend"
        )

        opts = [
            cfg.StrOpt('ipa-host', default='localhost.localdomain',
                       help='IPA RPC listener host - must be FQDN'),
            cfg.IntOpt('ipa-port', default=IPA_DEFAULT_PORT,
                       help='IPA RPC listener port'),
            cfg.StrOpt('ipa-client-keytab',
                       help='Kerberos client keytab file'),
            cfg.StrOpt('ipa-auth-driver-class',
                       default='designate.backend.impl_ipa.auth.IPAAuth',
                       help='Class that implements the authentication '
                       'driver for IPA'),
            cfg.StrOpt('ipa-ca-cert',
                       help='CA certificate for use with https to IPA'),
            cfg.StrOpt('ipa-base-url', default='/ipa',
                       help='Base URL for IPA RPC, relative to host[:port]'),
            cfg.StrOpt('ipa-json-url',
                       default='/json',
                       help='URL for IPA JSON RPC, relative to IPA base URL'),
            cfg.IntOpt('ipa-connect-retries', default=1,
                       help='How many times Designate will attempt to retry '
                       'the connection to IPA before giving up'),
            cfg.BoolOpt('ipa-force-ns-use', default=False,
                        help='IPA requires that a specified '
                        'name server or SOA MNAME is resolvable - if this '
                        'option is set, Designate will force IPA to use a '
                        'given name server even if it is not resolvable'),
            cfg.StrOpt('ipa-version', default='2.65',
                       help='IPA RPC JSON version')
        ]

        return [(group, opts)] 
開發者ID:openstack,項目名稱:designate,代碼行數:38,代碼來源:__init__.py


注:本文中的oslo_config.cfg.IntOpt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。