Python oslo_config.cfg.Opt() Examples
The following are 6
code examples of oslo_config.cfg.Opt().
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: test_conf.py From zun with Apache License 2.0 | 5 votes |
def test_list_opts(self): for group, opt_list in opts.list_opts(): if isinstance(group, str): self.assertEqual('DEFAULT', group) else: self.assertIsInstance(group, cfg.OptGroup) for opt in opt_list: self.assertIsInstance(opt, cfg.Opt)
Example #2
Source File: test_conf.py From magnum with Apache License 2.0 | 5 votes |
def test_list_opts(self): for group, opt_list in opts.list_opts(): if isinstance(group, six.string_types): self.assertEqual(group, 'DEFAULT') else: self.assertIsInstance(group, cfg.OptGroup) for opt in opt_list: self.assertIsInstance(opt, cfg.Opt)
Example #3
Source File: config.py From st2 with Apache License 2.0 | 5 votes |
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 #4
Source File: utils.py From cyborg with Apache License 2.0 | 5 votes |
def _dummy_opt(name): # A config option that can't be set by the user, so it behaves as if it's # ignored; but consuming code may expect it to be present in a conf group. return cfg.Opt(name, type=lambda x: None)
Example #5
Source File: config.py From syntribos with Apache License 2.0 | 4 votes |
def list_syntribos_opts(): def wrap_try_except(func): def wrap(*args): try: func(*args) except IOError: msg = _( "\nCan't open a file or directory specified in the " "config file under the section `[syntribos]`; verify " "if the path exists.\nFor more information please refer " "the debug logs.") print(msg) exit(1) return wrap return [ cfg.StrOpt("endpoint", default="", sample_default="http://localhost/app", help=_("The target host to be tested")), cfg.IntOpt("threads", default=16, sample_default="16", help=_("Maximum number of threads syntribos spawns " "(experimental)")), cfg.Opt("templates", type=ContentType("r"), default="", sample_default="~/.syntribos/templates", help=_("A directory of template files, or a single " "template file, to test on the target API")), cfg.StrOpt("payloads", default="", sample_default="~/.syntribos/data", help=_( "The location where we can find syntribos'" "payloads")), cfg.MultiStrOpt("exclude_results", default=[""], sample_default=["500_errors", "length_diff"], help=_( "Defect types to exclude from the " "results output")), cfg.Opt("custom_root", type=wrap_try_except(ExistingDirType()), short="c", sample_default="/your/custom/root", help=_( "The root directory where the subfolders that make up" " syntribos' environment (logs, templates, payloads, " "configuration files, etc.)"), deprecated_for_removal=True), cfg.StrOpt("meta_vars", sample_default="/path/to/meta.json", help=_( "The path to a meta variable definitions file, which " "will be used when parsing your templates")), ]
Example #6
Source File: config.py From st2 with Apache License 2.0 | 4 votes |
def _register_sensor_container_opts(ignore_errors=False): logging_opts = [ cfg.StrOpt( 'logging', default='/etc/st2/logging.sensorcontainer.conf', help='location of the logging.conf file') ] st2cfg.do_register_opts(logging_opts, group='sensorcontainer', ignore_errors=ignore_errors) # Partitioning options 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.') ] st2cfg.do_register_opts(partition_opts, group='sensorcontainer', ignore_errors=ignore_errors) # 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.') ] st2cfg.do_register_opts(other_opts, group='sensorcontainer', ignore_errors=ignore_errors) # 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.') ] st2cfg.do_register_cli_opts(cli_opts, ignore_errors=ignore_errors)