예제 #1
0
def test_nocloud(deployer, config):
    testdeployer = deployer.copy()
    assert InitializeDeployerTemplate.get("AWS", testdeployer,
                                          config) is not None
    assert InitializeDeployerTemplate.get("GCP", testdeployer,
                                          config) is not None
    with pytest.raises(NotImplementedError):
        InitializeDeployerTemplate.get("sdsd", testdeployer, config)
예제 #2
0
def deployer(ctx, name, cloud, artifact_bucket, registry_table, wait, dryrun,
             output_location):
    """Create artifact bucket and registry table. Initialize your deployer"""
    ctx.obj.require_cloud_access()
    cloud = cloud.upper()

    name = validate_name(name)
    artifact_bucket = validate_bucket(name, artifact_bucket)
    registry_table = validate_registry(
        name, registry_table) if cloud == "AWS" else None

    deployer = {
        "name": name,
        "cloud": cloud,
        "artifact": artifact_bucket,
        "registry": registry_table,
    }
    click.echo(json.dumps(deployer))

    config = ctx.obj.config
    Compiler.build_template(
        deployer,
        InitializeDeployerTemplate.get(cloud, deployer, config),
        cloud=cloud,
        wait=wait,
        dryrun=dryrun,
        output_folder=output_location,
    )

    save_deployer(deployer, config)