Search in sources :

Example 1 with DisabledException

use of com.synopsys.integration.blackduck.dockerinspector.exception.DisabledException in project blackduck-docker-inspector by blackducksoftware.

the class DockerClientManager method getTarFileFromDockerImage.

private ImageTarWrapper getTarFileFromDockerImage(String imageName, String tagName, File imageTarDirectory) throws IntegrationException, IOException {
    Optional<String> targetImageId = Optional.empty();
    try {
        targetImageId = getImageId(imageName, tagName);
    } catch (DisabledException disabledException) {
        logger.info("Image pulling is disabled in offline mode");
    } catch (Exception e) {
        throwIfPlatformSpecified(imageName, tagName, e);
        logger.warn(String.format("Unable to pull %s:%s; Proceeding anyway since the image might be in local docker image cache. Error on pull: %s", imageName, tagName, e.getMessage()));
    }
    File imageTarFile = saveImageToDir(imageTarDirectory, imageTarFilename.deriveImageTarFilenameFromImageTag(imageName, tagName), imageName, tagName);
    ImageTarWrapper imageTarWrapper = new ImageTarWrapper(imageTarFile, imageName, tagName);
    if (config.isCleanupTargetImage() && targetImageId.isPresent()) {
        removeImage(targetImageId.get());
    }
    return imageTarWrapper;
}
Also used : ImageTarWrapper(com.synopsys.integration.blackduck.dockerinspector.output.ImageTarWrapper) DisabledException(com.synopsys.integration.blackduck.dockerinspector.exception.DisabledException) File(java.io.File) IntegrationException(com.synopsys.integration.exception.IntegrationException) DisabledException(com.synopsys.integration.blackduck.dockerinspector.exception.DisabledException) NotFoundException(com.github.dockerjava.api.exception.NotFoundException) IOException(java.io.IOException) BlackDuckIntegrationException(com.synopsys.integration.blackduck.exception.BlackDuckIntegrationException)

Aggregations

NotFoundException (com.github.dockerjava.api.exception.NotFoundException)1 DisabledException (com.synopsys.integration.blackduck.dockerinspector.exception.DisabledException)1 ImageTarWrapper (com.synopsys.integration.blackduck.dockerinspector.output.ImageTarWrapper)1 BlackDuckIntegrationException (com.synopsys.integration.blackduck.exception.BlackDuckIntegrationException)1 IntegrationException (com.synopsys.integration.exception.IntegrationException)1 File (java.io.File)1 IOException (java.io.IOException)1