示例#1
0
def write_qhub_config_to_file(setup_fixture):
    qhub_config_loc, render_config_inputs = setup_fixture
    (
        project,
        namespace,
        domain,
        cloud_provider,
        ci_provider,
        auth_provider,
    ) = render_config_inputs

    config = render_config_partial(
        project_name=project,
        namespace=namespace,
        qhub_domain=domain,
        cloud_provider=cloud_provider,
        ci_provider=ci_provider,
        auth_provider=auth_provider,
        kubernetes_version=None,
    )

    # write to qhub_config.yaml
    yaml = YAML(typ="unsafe", pure=True)
    yaml.dump(config, qhub_config_loc)

    render_template(str(qhub_config_loc.parent), qhub_config_loc, force=True)

    yield setup_fixture
示例#2
0
def handle_render(args):
    config_filename = pathlib.Path(args.config)
    if not config_filename.is_file():
        raise ValueError(
            f"passed in configuration filename={config_filename} must exist")

    config = load_yaml(config_filename)

    verify(config)

    render_template(args.output, args.config, force=True)
示例#3
0
def handle_destroy(args):
    config_filename = pathlib.Path(args.config)
    if not config_filename.is_file():
        raise ValueError(
            f"passed in configuration filename={config_filename} must exist")

    config = load_yaml(config_filename)

    verify(config)

    if not args.disable_render:
        render_template(args.output, args.config, force=True)

    destroy_configuration(
        config,
        args.skip_remote_state_provision,
        args.full_only,
    )
示例#4
0
def handle_render(args):
    import pathlib
    import yaml

    config_filename = pathlib.Path(args.config)
    if not config_filename.is_file():
        raise ValueError(
            f"passed in configuration filename={config_filename} must exist"
        )

    with config_filename.open() as f:
        config = yaml.safe_load(f.read())

    verify(config)

    if args.input is None:
        render_default_template(args.output, args.config, force=args.force)
    else:
        render_template(args.input, args.output, args.config, force=args.force)
示例#5
0
def init_render(request, tmp_path):
    (
        project,
        namespace,
        domain,
        cloud_provider,
        ci_provider,
        auth_provider,
    ) = request.param

    output_directory = tmp_path / f"{cloud_provider}_output_dir"
    output_directory.mkdir()
    qhub_config = output_directory / QHUB_CONFIG_FN

    # data that should NOT be deleted when `qhub render` is called
    preserved_directory = output_directory / PRESERVED_DIR
    preserved_directory.mkdir()
    preserved_filename = preserved_directory / "file.txt"
    preserved_filename.write_text("This is a test...")

    config = render_config(
        project_name=project,
        namespace=namespace,
        qhub_domain=domain,
        cloud_provider=cloud_provider,
        ci_provider=ci_provider,
        repository="github.com/test/test",
        auth_provider=auth_provider,
        repository_auto_provision=False,
        auth_auto_provision=False,
        terraform_state="remote",
        kubernetes_version="1.18.0",
        disable_prompt=True,
    )
    yaml = YAML(typ="unsafe", pure=True)
    yaml.dump(config, qhub_config)

    render_template(str(output_directory), qhub_config, force=True)

    yield (output_directory, request)