summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorralph isenmann2022-02-15 17:49:52 +0100
committerralph isenmann2022-02-15 17:50:43 +0100
commit83ec96e9ec004680463e42d8cc6a30805c4048cd (patch)
tree342ccdc138fc2456f9fe6facdefff920bfb86014
parent[CLIENT] remove useless logging message (diff)
downloadtutor-module-83ec96e9ec004680463e42d8cc6a30805c4048cd.tar.gz
tutor-module-83ec96e9ec004680463e42d8cc6a30805c4048cd.tar.xz
tutor-module-83ec96e9ec004680463e42d8cc6a30805c4048cd.zip
[CLIENT] fix isDataContainer check, dont let vm image pass.
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java14
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