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;
}
Aggregations