summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/org')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java1
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java19
2 files changed, 12 insertions, 8 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java
index 389e4005..d0f562b6 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java
@@ -76,6 +76,7 @@ public class ContainerUploadPage extends ContainerUploadPageLayout {
containerDefinition = ContainerUtils.getContainerDefinition(
Session.getSatelliteToken(),
+ imageDetailsRead.getImageName(),
imageDetailsRead.getLatestVersionId());
lblImageName.setEnabled(existingImage == null);
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 d6836c8d..5f0dd887 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java
@@ -62,7 +62,7 @@ public class ContainerUtils {
public static boolean isDataContainer(ImageSummaryRead image) {
- ContainerDefinition containerDefinition = getContainerDefinition(Session.getSatelliteToken(), image.getLatestVersionId());
+ ContainerDefinition containerDefinition = getContainerDefinition(Session.getSatelliteToken(), image.getImageName(), image.getLatestVersionId());
if (containerDefinition.getContainerMeta().getImageType() == ContainerMeta.ContainerImageType.DATA) {
return true;
}
@@ -75,10 +75,9 @@ public class ContainerUtils {
List<ImageSummaryRead> dataContainerImages = new ArrayList<>();
for (ImageSummaryRead image : images) {
if (image.getVirtId().equals(TConst.VIRT_DOCKER)) {
-
- ContainerDefinition containerDefinition = getContainerDefinition(satelliteToken, image.getLatestVersionId());
- if (containerDefinition.getContainerMeta().getImageType() == ContainerMeta.ContainerImageType.DATA)
- dataContainerImages.add(image);
+ ContainerDefinition containerDefinition = getContainerDefinition(satelliteToken, image.getImageName(), image.getLatestVersionId());
+ if (containerDefinition != null && containerDefinition.getContainerMeta().getImageType() == ContainerMeta.ContainerImageType.DATA)
+ dataContainerImages.add(image);
}
}
return dataContainerImages;
@@ -89,15 +88,19 @@ public class ContainerUtils {
MessageType.WARNING, logger, null);
}
- public static ContainerDefinition getContainerDefinition(String satelliteToken, String latestVersionId) {
+ public static ContainerDefinition getContainerDefinition(String satelliteToken, String imageName, String latestVersionId) {
byte[] rawVirtConfig = null;
+ if (latestVersionId == null) {
+ LOGGER.warn(String.format("LatestVersionID is null, cannot retrieve virtualizer config for image '%s'",imageName));
+ return null;
+ }
try {
ByteBuffer byteBuffer = ThriftManager.getSatClient().getImageVersionVirtConfig(satelliteToken,
latestVersionId);
rawVirtConfig = ThriftUtil.unwrapByteBuffer(byteBuffer);
} catch (TException e) {
- LOGGER.error("Failed to retrieve virtualizer config for image version " + "'" + latestVersionId
- + ", see trace: ", e);
+ LOGGER.error(String.format(" Failed to retrieve virtualizer config for image '%s' with image version '%s', see trace:",
+ imageName, latestVersionId), e);
return null;
}
return ContainerDefinition.fromByteArray(rawVirtConfig);