Beispiel #1
0
def test_blueprint_no_root(blueprint_no_root_config):
    with pytest.raises(ValidationError):
        validate_blueprint(blueprint_no_root_config)
Beispiel #2
0
def test_blueprint_pkg_as_array_block(blueprint_pkg_array_block_config):
    validate_blueprint(blueprint_pkg_array_block_config)
Beispiel #3
0
def test_config_is_not_valid_blueprint(valid_config):
    with pytest.raises(ValidationError):
        validate_blueprint(valid_config)
Beispiel #4
0
def test_blueprint_add_vars(blueprint_add_vars_config):
    with pytest.raises(ValidationError):
        validate_blueprint(blueprint_add_vars_config)
Beispiel #5
0
def test_blueprint_duplicate_pkg(blueprint_duplicate_pkg_config):
    with pytest.raises(ValidationError):
        validate_blueprint(blueprint_duplicate_pkg_config)
Beispiel #6
0
def test_invalid_blueprint(invalid_blueprint_config):
    with pytest.raises(ValidationError):
        validate_blueprint(invalid_blueprint_config)
Beispiel #7
0
    validate_blueprint,
    validate_config,
)

if __name__ == "__main__":
    parser = argparse.ArgumentParser(prog="pailman")
    define_cli(parser)
    opts = parser.parse_args()

    print("using config {}".format(config_file(opts)))
    cfg = read_config(config_file(opts))

    try:
        validate_config(cfg)
    except ValidationError as error:
        print("config is invalid: {}".format(error.message))
        sys.exit(1)

    blueprints = read_blueprints()

    for p, blueprint in blueprints.items():
        try:
            validate_blueprint(blueprint)
        except ValidationError as error:
            print("blueprint {} is invalid: {}".format(p, error.message))
            sys.exit(1)
    print("{} blueprints available".format(len(blueprints)))

    print("to install: {}".format(to_install(opts)))
    print("to destroy: {}".format(to_destroy(opts)))