summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/libertacasa/pubsh
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/libertacasa/pubsh')
-rw-r--r--src/main/java/net/libertacasa/pubsh/web/SchedulerBean.java1
-rw-r--r--src/main/java/net/libertacasa/pubsh/web/WebApplication.java14
2 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/net/libertacasa/pubsh/web/SchedulerBean.java b/src/main/java/net/libertacasa/pubsh/web/SchedulerBean.java
index b68a14a..26408df 100644
--- a/src/main/java/net/libertacasa/pubsh/web/SchedulerBean.java
+++ b/src/main/java/net/libertacasa/pubsh/web/SchedulerBean.java
@@ -26,7 +26,6 @@ public class SchedulerBean {
@Bean
public static Task<Void> shellRemovalTask() {
-
return Tasks.oneTime("shell-removal")
.execute((instance, ctx) -> {
System.out.printf("Running container removal task - Instance: %s, ctx: %s\n", instance, ctx);
diff --git a/src/main/java/net/libertacasa/pubsh/web/WebApplication.java b/src/main/java/net/libertacasa/pubsh/web/WebApplication.java
index a22c390..55628fe 100644
--- a/src/main/java/net/libertacasa/pubsh/web/WebApplication.java
+++ b/src/main/java/net/libertacasa/pubsh/web/WebApplication.java
@@ -276,7 +276,19 @@ public class WebApplication {
System.out.printf("Deletion triggered for ID %s by %s (%s)\n", id, userid, username);
- Docker.deleteShell(username, id);
+ try {
+ Docker.deleteShell(username, id);
+ String returnmessage = "Ok, deleted the shell with container ID " + id;
+ redirectAttributes.addFlashAttribute("message", returnmessage);
+ } catch (com.github.dockerjava.api.exception.NotFoundException exception) {
+ String returnmessage = "Shell does not exist, maybe it already expired?";
+ redirectAttributes.addFlashAttribute("message", returnmessage);
+ System.out.println(exception);
+ } catch (Exception exception) {
+ String returnmessage = "Error.";
+ redirectAttributes.addFlashAttribute("message", returnmessage);
+ System.out.println(exception);
+ }
return("redirect:/portal");
}