diff options
Diffstat (limited to 'dozentenmodul')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java index 7ec6ef13..1c71abdd 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java @@ -60,9 +60,11 @@ public class ContainerUtils { public static boolean isDataContainer(ImageSummaryRead image) { - ContainerDefinition containerDefinition = getContainerDefinition(Session.getSatelliteToken(), image.getImageName(), image.getLatestVersionId()); - if (containerDefinition.getContainerMeta().getImageType() == ContainerMeta.ContainerImageType.DATA) { - return true; + if (image != null && image.getVirtId().equals(TConst.VIRT_DOCKER)) { + ContainerDefinition containerDefinition = getContainerDefinition(Session.getSatelliteToken(), image.getImageName(), image.getLatestVersionId()); + if (containerDefinition.getContainerMeta().getImageType() == ContainerMeta.ContainerImageType.DATA) { + return true; + } } return false; } @@ -73,7 +75,7 @@ public class ContainerUtils { List<ImageSummaryRead> dataContainerImages = new ArrayList<>(); for (ImageSummaryRead image : images) { if (image.getVirtId().equals(TConst.VIRT_DOCKER)) { - ContainerDefinition containerDefinition = getContainerDefinition(satelliteToken, image.getImageName(), image.getLatestVersionId()); + ContainerDefinition containerDefinition = getContainerDefinition(satelliteToken, image.getImageName(), image.getLatestVersionId()); if (containerDefinition != null && containerDefinition.getContainerMeta().getImageType() == ContainerMeta.ContainerImageType.DATA) dataContainerImages.add(image); } @@ -123,14 +125,14 @@ public class ContainerUtils { try { TarArchiveReader tarReader = new TarArchiveReader(new FileInputStream(tarFile)); - + while (tarReader.hasNextEntry()) { if (tarReader.getEntryName().equals("manifest.json")) { containsManifest = true; manifestJson = JsonParser.parseString(new String(tarReader.readCurrentEntry(), StandardCharsets.UTF_8)) .getAsJsonArray(); } - + if (tarReader.getEntryName().equals("repositories")) { containsRepositories = true; // just check if the file exists |