Python oslo_config.cfg.MultiStrOpt() Examples

The following are 6 code examples of oslo_config.cfg.MultiStrOpt(). 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: multi_backend.py    From glance_store with Apache License 2.0 5 votes vote down vote up
def register_store_opts(conf, reserved_stores=None):
    LOG.debug("Registering options for group %s", _STORE_CFG_GROUP)
    conf.register_opts(_STORE_OPTS, group=_STORE_CFG_GROUP)

    configured_backends = copy.deepcopy(conf.enabled_backends)
    if reserved_stores:
        conf.enabled_backends.update(reserved_stores)
        for key in reserved_stores.keys():
            fs_conf_template = [
                cfg.StrOpt('filesystem_store_datadir',
                           default='/var/lib/glance/{}'.format(key),
                           help=FS_CONF_DATADIR_HELP.format(key)),
                cfg.MultiStrOpt('filesystem_store_datadirs',
                                help="""Not used"""),
                cfg.StrOpt('filesystem_store_metadata_file',
                           help="""Not used"""),
                cfg.IntOpt('filesystem_store_file_perm',
                           default=0,
                           help="""Not used"""),
                cfg.IntOpt('filesystem_store_chunk_size',
                           default=64 * units.Ki,
                           min=1,
                           help=FS_CONF_CHUNKSIZE_HELP.format(key))]
            LOG.debug("Registering options for reserved store: {}".format(key))
            conf.register_opts(fs_conf_template, group=key)

    driver_opts = _list_driver_opts()
    for backend in configured_backends:
        for opt_list in driver_opts:
            if configured_backends[backend] not in opt_list:
                continue

            LOG.debug("Registering options for group %s", backend)
            conf.register_opts(driver_opts[opt_list], group=backend) 
Example #2
Source File: setup_pack_virtualenv.py    From st2 with Apache License 2.0 5 votes vote down vote up
def _register_cli_opts():
    cli_opts = [
        cfg.MultiStrOpt('pack', default=None, required=True, positional=True,
                        help='Name of the pack to setup the virtual environment for.'),
        cfg.BoolOpt('update', default=False,
                   help=('Check this option if the virtual environment already exists and if you '
                         'only want to perform an update and installation of new dependencies. If '
                         'you don\'t check this option, the virtual environment will be destroyed '
                         'then re-created. If you check this and the virtual environment doesn\'t '
                         'exist, it will create it..')),
        cfg.BoolOpt('python3', default=False,
                    help='Use Python 3 binary when creating a virtualenv for this pack.'),
    ]
    do_register_cli_opts(cli_opts) 
Example #3
Source File: install_pack.py    From st2 with Apache License 2.0 5 votes vote down vote up
def _register_cli_opts():
    cli_opts = [
        cfg.MultiStrOpt('pack', default=None, required=True, positional=True,
                        help='Name of the pack to install.'),
        cfg.BoolOpt('verify-ssl', default=True,
                   help=('Verify SSL certificate of the Git repo from which the pack is '
                         'downloaded.')),
        cfg.BoolOpt('force', default=False,
                    help='True to force pack installation and ignore install '
                         'lock file if it exists.'),
        cfg.BoolOpt('use-python3', default=False,
                    help='True to use Python3 binary when creating virtualenv '
                         'for this pack.'),
    ]
    do_register_cli_opts(cli_opts) 
Example #4
Source File: download_pack.py    From st2 with Apache License 2.0 5 votes vote down vote up
def _register_cli_opts():
    cli_opts = [
        cfg.MultiStrOpt('pack', default=None, required=True, positional=True,
                        help='Name of the pack to install (download).'),
        cfg.BoolOpt('verify-ssl', default=True,
                   help=('Verify SSL certificate of the Git repo from which the pack is '
                         'installed.')),
        cfg.BoolOpt('force', default=False,
                    help='True to force pack download and ignore download '
                         'lock file if it exists.'),
        cfg.BoolOpt('use-python3', default=False,
                    help='True to use Python3 binary.')
    ]
    do_register_cli_opts(cli_opts) 
Example #5
Source File: config.py    From syntribos with Apache License 2.0 4 votes vote down vote up
def list_cli_opts():
    return [
        cfg.SubCommandOpt(name="sub_command",
                          handler=sub_commands,
                          help=_("Available commands"),
                          title="syntribos Commands"),
        cfg.MultiStrOpt("test-types", dest="test_types", short="t",
                        default=[""], sample_default=["SQL", "XSS"],
                        help=_(
                            "Test types to run against the target API")),
        cfg.MultiStrOpt("excluded-types", dest="excluded_types", short="e",
                        default=[""], sample_default=["SQL", "XSS"],
                        help=_("Test types to be excluded from "
                               "current run against the target API")),
        cfg.BoolOpt("colorize", dest="colorize", short="cl",
                    default=True,
                    help=_("Enable color in syntribos terminal output")),
        cfg.StrOpt("outfile", short="o",
                   sample_default="out.json", help=_("File to print "
                                                     "output to")),
        cfg.StrOpt("format", dest="output_format", short="f", default="json",
                   choices=["json"], ignore_case=True,
                   help=_("The format for outputting results")),
        cfg.StrOpt("min-severity", dest="min_severity", short="S",
                   default="LOW", choices=syntribos.RANKING,
                   help=_("Select a minimum severity for reported "
                          "defects")),
        cfg.StrOpt("min-confidence", dest="min_confidence", short="C",
                   default="LOW", choices=syntribos.RANKING,
                   help=_("Select a minimum confidence for reported "
                          "defects")),
        cfg.BoolOpt("stacktrace", dest="stacktrace", default=True,
                    help=_("Select if Syntribos outputs a stacktrace "
                           " if an exception is raised")),
        cfg.StrOpt(
            "custom_root", dest="custom_root",
            help=_("Filesystem location for syntribos root directory, "
                   "containing logs, templates, payloads, config files. "
                   "Creates directories and skips interactive prompts when "
                   "used with 'syntribos init'"),
            deprecated_group="init", deprecated_name="custom_install_root")
    ] 
Example #6
Source File: config.py    From syntribos with Apache License 2.0 4 votes vote down vote up
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")),
    ]