Python oslo_config.cfg.StrOpt() Examples

The following are 30 code examples of oslo_config.cfg.StrOpt(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module oslo_config.cfg , or try the search function .
Example #1
Source File: openstack.py    From cloudbase-init with Apache License 2.0 6 votes vote down vote up
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."),
        ] 
Example #2
Source File: options.py    From promenade with Apache License 2.0 6 votes vote down vote up
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') 
Example #3
Source File: config.py    From st2 with Apache License 2.0 6 votes vote down vote up
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') 
Example #4
Source File: config.py    From syntribos with Apache License 2.0 6 votes vote down vote up
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")),
    ] 
Example #5
Source File: config.py    From st2 with Apache License 2.0 6 votes vote down vote up
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') 
Example #6
Source File: base.py    From searchlight with Apache License 2.0 6 votes vote down vote up
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 
Example #7
Source File: test_static_driver.py    From vitrage with Apache License 2.0 6 votes vote down vote up
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) 
Example #8
Source File: gce.py    From cloudbase-init with Apache License 2.0 6 votes vote down vote up
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."),
        ] 
Example #9
Source File: cloudstack.py    From cloudbase-init with Apache License 2.0 6 votes vote down vote up
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"),
        ] 
Example #10
Source File: ovf.py    From cloudbase-init with Apache License 2.0 6 votes vote down vote up
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"),
        ] 
Example #11
Source File: undercloud_preflight.py    From python-tripleoclient with Apache License 2.0 6 votes vote down vote up
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 
Example #12
Source File: ec2.py    From cloudbase-init with Apache License 2.0 6 votes vote down vote up
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."),
        ] 
Example #13
Source File: trigger_re_fire.py    From st2 with Apache License 2.0 6 votes vote down vote up
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:]) 
Example #14
Source File: base.py    From python-tripleoclient with Apache License 2.0 6 votes vote down vote up
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) 
Example #15
Source File: netns_wrapper.py    From neutron-vpnaas with Apache License 2.0 6 votes vote down vote up
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 
Example #16
Source File: config.py    From st2 with Apache License 2.0 6 votes vote down vote up
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') 
Example #17
Source File: test_ovsdb_lib.py    From os-vif with Apache License 2.0 6 votes vote down vote up
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() 
Example #18
Source File: config.py    From st2 with Apache License 2.0 6 votes vote down vote up
def _register_app_opts():
    dump_opts = [
        cfg.StrOpt(
            'dump_dir', default='/opt/stackstorm/exports/',
            help='Directory to dump data to.')
    ]

    CONF.register_opts(dump_opts, group='exporter')

    logging_opts = [
        cfg.StrOpt(
            'logging', default='/etc/st2/logging.exporter.conf',
            help='location of the logging.exporter.conf file')
    ]

    CONF.register_opts(logging_opts, group='exporter') 
Example #19
Source File: test_db_manage.py    From watcher with Apache License 2.0 6 votes vote down vote up
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) 
Example #20
Source File: test_db_manage.py    From watcher with Apache License 2.0 6 votes vote down vote up
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) 
Example #21
Source File: test_db_manage.py    From watcher with Apache License 2.0 6 votes vote down vote up
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() 
Example #22
Source File: shell.py    From oslo.policy with Apache License 2.0 5 votes vote down vote up
def main():
    conf = cfg.ConfigOpts()

    conf.register_cli_opt(cfg.StrOpt(
        'policy',
        required=True,
        help='path to a policy file.'))

    conf.register_cli_opt(cfg.StrOpt(
        'access',
        required=True,
        help='path to a file containing OpenStack Identity API '
             'access info in JSON format.'))

    conf.register_cli_opt(cfg.StrOpt(
        'target',
        help='path to a file containing custom target info in '
             'JSON format. This will be used to evaluate the policy with.'))

    conf.register_cli_opt(cfg.StrOpt(
        'rule',
        help='rule to test.'))

    conf.register_cli_opt(cfg.BoolOpt(
        'is_admin',
        help='set is_admin=True on the credentials used for the evaluation.',
        default=False))

    conf.register_cli_opt(cfg.StrOpt(
        'enforcer_config',
        help='configuration file for the oslopolicy-checker enforcer'))

    conf()

    tool(conf.policy, conf.access, conf.rule, conf.is_admin,
         conf.target, conf.enforcer_config) 
Example #23
Source File: powervm.py    From nova-powervm with Apache License 2.0 5 votes vote down vote up
def _register_fabrics(conf, fabric_mapping):
    """Registers the fabrics to WWPNs options and builds a mapping.

    This method registers the 'fabric_X_port_wwpns' (where X is determined by
    the 'fabrics' option values) and then builds a dictionary that mapps the
    fabrics to the WWPNs.  This mapping can then be later used without having
    to reparse the options.
    """
    # At this point, the fabrics should be specified.  Iterate over those to
    # determine the port_wwpns per fabric.
    if conf.powervm.fabrics is not None:
        port_wwpn_keys = []
        fabrics = conf.powervm.fabrics.split(',')
        for fabric in fabrics:
            opt = cfg.StrOpt('fabric_%s_port_wwpns' % fabric,
                             default='', help=FABRIC_WWPN_HELP)
            port_wwpn_keys.append(opt)

        conf.register_opts(port_wwpn_keys, group='powervm')

        # Now that we've registered the fabrics, saturate the NPIV dictionary
        for fabric in fabrics:
            key = 'fabric_%s_port_wwpns' % fabric
            wwpns = conf.powervm[key].split(',')
            wwpns = [x.upper().strip(':') for x in wwpns]
            fabric_mapping[fabric] = wwpns 
Example #24
Source File: config.py    From st2 with Apache License 2.0 5 votes vote down vote up
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') 
Example #25
Source File: st2-analyze-links.py    From st2 with Apache License 2.0 5 votes vote down vote up
def main():
    monkey_patch()

    cli_opts = [
        cfg.StrOpt('action_ref', default=None,
                   help='Root action to begin analysis.'),
        cfg.StrOpt('link_trigger_ref', default='core.st2.generic.actiontrigger',
                   help='Root action to begin analysis.'),
        cfg.StrOpt('out_file', default='pipeline')
    ]
    do_register_cli_opts(cli_opts)
    config.parse_args()
    db_setup()
    rule_links = LinksAnalyzer().analyze(cfg.CONF.action_ref, cfg.CONF.link_trigger_ref)
    Grapher().generate_graph(rule_links, cfg.CONF.out_file) 
Example #26
Source File: purge_trigger_instances.py    From st2 with Apache License 2.0 5 votes vote down vote up
def _register_cli_opts():
    cli_opts = [
        cfg.StrOpt('timestamp', default=None,
                   help='Will delete trigger instances older than ' +
                   'this UTC timestamp. ' +
                   'Example value: 2015-03-13T19:01:27.255542Z')
    ]
    do_register_cli_opts(cli_opts) 
Example #27
Source File: config.py    From st2 with Apache License 2.0 5 votes vote down vote up
def _register_results_tracker_opts():
    resultstracker_opts = [
        cfg.StrOpt(
            'logging', default='/etc/st2/logging.resultstracker.conf',
            help='Location of the logging configuration file.')
    ]

    CONF.register_opts(resultstracker_opts, group='resultstracker') 
Example #28
Source File: config.py    From st2 with Apache License 2.0 5 votes vote down vote up
def _register_sensor_container_opts():
    partition_opts = [
        cfg.StrOpt(
            'sensor_node_name', default='sensornode1',
            help='name of the sensor node.'),
        cfg.Opt(
            'partition_provider',
            type=types.Dict(value_type=types.String()),
            default={'name': DEFAULT_PARTITION_LOADER},
            help='Provider of sensor node partition config.')
    ]

    _register_opts(partition_opts, group='sensorcontainer')

    # Other options
    other_opts = [
        cfg.BoolOpt(
            'single_sensor_mode', default=False,
            help='Run in a single sensor mode where parent process exits when a sensor crashes / '
                 'dies. This is useful in environments where partitioning, sensor process life '
                 'cycle and failover is handled by a 3rd party service such as kubernetes.')
    ]

    _register_opts(other_opts, group='sensorcontainer')

    # CLI options
    cli_opts = [
        cfg.StrOpt(
            'sensor-ref',
            help='Only run sensor with the provided reference. Value is of the form '
                 '<pack>.<sensor-name> (e.g. linux.FileWatchSensor).'),
        cfg.BoolOpt(
            'single-sensor-mode', default=False,
            help='Run in a single sensor mode where parent process exits when a sensor crashes / '
                 'dies. This is useful in environments where partitioning, sensor process life '
                 'cycle and failover is handled by a 3rd party service such as kubernetes.')
    ]

    _register_cli_opts(cli_opts) 
Example #29
Source File: config.py    From st2 with Apache License 2.0 5 votes vote down vote up
def _register_auth_opts():
    auth_opts = [
        cfg.StrOpt('host', default='127.0.0.1'),
        cfg.IntOpt('port', default=9100),
        cfg.BoolOpt('use_ssl', default=False),
        cfg.StrOpt('mode', default='proxy'),
        cfg.StrOpt('backend', default='flat_file'),
        cfg.StrOpt('backend_kwargs', default=None),
        cfg.StrOpt('logging', default='conf/logging.conf'),
        cfg.IntOpt('token_ttl', default=86400, help='Access token ttl in seconds.'),
        cfg.BoolOpt('debug', default=True)
    ]

    _register_opts(auth_opts, group='auth') 
Example #30
Source File: test_db_manage.py    From watcher with Apache License 2.0 5 votes vote down vote up
def test_run_db_revision(self, m_revision):
        cfg.CONF.register_opt(cfg.StrOpt("message"), group="command")
        cfg.CONF.register_opt(cfg.StrOpt("autogenerate"), group="command")
        cfg.CONF.set_default(
            "message", "dummy_message", group="command"
        )
        cfg.CONF.set_default(
            "autogenerate", "dummy_autogenerate", group="command"
        )
        dbmanage.DBCommand.revision()

        m_revision.assert_called_once_with(
            "dummy_message", "dummy_autogenerate"
        )