コード例 #1
0
def handle_validate(args):
    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)
コード例 #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
ファイル: deploy.py プロジェクト: leej3/qhub-cloud
def handle_deploy(args):
    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)

    deploy_configuration(config, args.dns_provider, args.dns_auto_provision,
                         args.disable_prompt)
コード例 #4
0
ファイル: destroy.py プロジェクト: jkellndorfer/qhub
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,
    )
コード例 #5
0
ファイル: render.py プロジェクト: leej3/qhub-cloud
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)
コード例 #6
0
ファイル: linter.py プロジェクト: jkellndorfer/qhub
def qhub_validate(config):
    # Gather the output of `qhub validate`.
    print("Validate: info: validating QHub configuration in qhub-config.yaml")

    def parse_validation(message):
        # this will just separate things for now, but can be enhanced
        return str(message)

    try:
        verify(config)
        msg = "validate: info: successfully validated QHub configuration"
        print(msg)
        return True, msg, 0

    except BaseException as e:
        msg = "validate: error: failed to validate QHub configuration."
        print(msg)
        validate_comment = parse_validation(e)
        validate_comment_wrapper = f"\n```\n{validate_comment}\n``` "
        return False, validate_comment_wrapper, 1
コード例 #7
0
ファイル: validate.py プロジェクト: jkellndorfer/qhub
def handle_validate(args):
    if args.configdeprecated and args.config:
        raise ValueError(
            "Please pass in -c/--config flag specifying your qhub-config.yaml file, and do NOT pass it as a standalone argument"
        )

    config_filename = args.config or args.configdeprecated
    if not config_filename:
        raise ValueError(
            "Please pass in a qhub-config.yaml filename using the -c/--config argument"
        )

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

    config = load_yaml(config_filename)

    if args.enable_commenting:
        # for PR's only
        comment_on_pr(config)
    else:
        verify(config)