Ejemplo n.º 1
0
def secrets_collection_factory(secrets=None,
                               plugins=(),
                               exclude_regex=''):  # pragma: no cover
    """
    :type secrets: list(dict)
    :param secrets: list of params to pass to add_secret.
                    Eg. [ {'secret': 'blah'}, ]

    :type plugins: tuple
    :type exclude_regex: str

    :rtype: SecretsCollection
    """
    collection = SecretsCollection(plugins, exclude_regex)

    if plugins:
        collection.plugins = plugins

    # Handle secrets
    if secrets is None:
        return collection

    for kwargs in secrets:
        _add_secret(collection, **kwargs)

    return collection
Ejemplo n.º 2
0
def secrets_collection_factory(secrets=None,
                               plugins=(),
                               exclude_files_regex=None):
    """
    :type secrets: list(dict)
    :param secrets: list of params to pass to add_secret.
                    E.g. [ {'secret': 'blah'}, ]

    :type plugins: tuple
    :type exclude_files_regex: str|None

    :rtype: SecretsCollection
    """
    collection = SecretsCollection(
        plugins,
        exclude_files=exclude_files_regex,
    )

    if plugins:
        for plugin in plugins:
            # We don't want to incur network calls during test cases
            plugin.should_verify = False

        collection.plugins = plugins

    # Handle secrets
    if secrets is None:
        return collection

    for kwargs in secrets:
        _add_secret(collection, **kwargs)

    return collection