Пример #1
0
def cli(ctx: click.Context, verbose: int, umask: int, **kwargs) -> None:
    """
    Interact with a Vault. See subcommands for details.

    All arguments can be passed by environment variables: VAULT_CLI_UPPERCASE_NAME
    (including VAULT_CLI_PASSWORD and VAULT_CLI_TOKEN).

    """
    kwargs.pop("render")
    kwargs.pop("config_file")
    set_verbosity(verbose)
    set_umask(umask)

    assert ctx.default_map  # make mypy happy
    kwargs.update(extract_special_args(ctx.default_map, os.environ))

    # There might still be files to read, so let's do it now
    kwargs = settings.read_all_files(kwargs)
    saved_settings = kwargs.copy()

    saved_settings.update({"verbose": verbose, "umask": repr_octal(umask)})

    ctx.obj = client.get_client_class()(**kwargs)  # type: ignore
    ctx.obj.auth()
    ctx.obj.saved_settings = saved_settings
Пример #2
0
def test_get_client_class():
    assert client.get_client_class() is client.VaultClient