Shell removal task exception handling

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2022-05-11 18:21:21 +02:00
parent 812cf73cb7
commit 2ea6f61744
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57
1 changed files with 7 additions and 3 deletions

View File

@ -29,9 +29,13 @@ public class SchedulerBean {
return Tasks.oneTime("shell-removal")
.execute((instance, ctx) -> {
System.out.printf("Running container removal task - Instance: %s, ctx: %s\n", instance, ctx);
String username = instance.getId().split("&")[0];
String containerid = instance.getId().split("&")[1];
Docker.deleteShell(username, containerid);
try {
String username = instance.getId().split("&")[0];
String containerid = instance.getId().split("&")[1];
Docker.deleteShell(username, containerid);
} catch (com.github.dockerjava.api.exception.NotFoundException exception) {
System.out.printf("Container does not exist\n");
}
});
}