Search in sources :

Example 1 with DockerClientWrapper

use of bio.terra.cli.app.utils.DockerClientWrapper in project terra-cli by DataBiosphere.

the class Image method execute.

/**
 * Updates the docker image id property of the global context.
 */
@Override
protected void execute() {
    Config config = Context.getConfig();
    String prevImageId = config.getDockerImageId();
    String newImageId = argGroup.useDefault ? Config.getDefaultImageId() : argGroup.imageId;
    if (!new DockerClientWrapper().checkImageExists(newImageId)) {
        ERR.printf("WARNING: Image %s was not found on the local machine. " + "Do `docker pull %s` to obtain it.%n", newImageId, newImageId);
    }
    config.setDockerImageId(newImageId);
    if (config.getDockerImageId().equals(prevImageId)) {
        OUT.println("Docker image: " + config.getDockerImageId() + " (UNCHANGED)");
    } else {
        OUT.println("Docker image: " + config.getDockerImageId() + " (CHANGED FROM " + prevImageId + ")");
    }
}
Also used : Config(bio.terra.cli.businessobject.Config) DockerClientWrapper(bio.terra.cli.app.utils.DockerClientWrapper)

Example 2 with DockerClientWrapper

use of bio.terra.cli.app.utils.DockerClientWrapper in project terra-cli by DataBiosphere.

the class AppLaunch method execute.

/**
 * Updates the command runner option property of the global context.
 */
@Override
protected void execute() {
    Config config = Context.getConfig();
    Config.CommandRunnerOption prevAppLaunchOption = config.getCommandRunnerOption();
    if (CommandRunnerOption.DOCKER_CONTAINER == mode) {
        String imageId = Context.getConfig().getDockerImageId();
        if (!new DockerClientWrapper().checkImageExists(imageId)) {
            ERR.printf("WARNING: Image %s was not found on the local machine. " + "Do `docker pull %s` to obtain it.%n", imageId, imageId);
        }
    }
    config.setCommandRunnerOption(mode);
    OUT.println("App launch mode is " + config.getCommandRunnerOption() + " (" + (config.getCommandRunnerOption() == prevAppLaunchOption ? "UNCHANGED" : "CHANGED") + ").");
}
Also used : Config(bio.terra.cli.businessobject.Config) CommandRunnerOption(bio.terra.cli.businessobject.Config.CommandRunnerOption) DockerClientWrapper(bio.terra.cli.app.utils.DockerClientWrapper)

Aggregations

DockerClientWrapper (bio.terra.cli.app.utils.DockerClientWrapper)2 Config (bio.terra.cli.businessobject.Config)2 CommandRunnerOption (bio.terra.cli.businessobject.Config.CommandRunnerOption)1