Shell removal task exception handling
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
parent
812cf73cb7
commit
2ea6f61744
@ -29,9 +29,13 @@ public class SchedulerBean {
|
|||||||
return Tasks.oneTime("shell-removal")
|
return Tasks.oneTime("shell-removal")
|
||||||
.execute((instance, ctx) -> {
|
.execute((instance, ctx) -> {
|
||||||
System.out.printf("Running container removal task - Instance: %s, ctx: %s\n", instance, ctx);
|
System.out.printf("Running container removal task - Instance: %s, ctx: %s\n", instance, ctx);
|
||||||
|
try {
|
||||||
String username = instance.getId().split("&")[0];
|
String username = instance.getId().split("&")[0];
|
||||||
String containerid = instance.getId().split("&")[1];
|
String containerid = instance.getId().split("&")[1];
|
||||||
Docker.deleteShell(username, containerid);
|
Docker.deleteShell(username, containerid);
|
||||||
|
} catch (com.github.dockerjava.api.exception.NotFoundException exception) {
|
||||||
|
System.out.printf("Container does not exist\n");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user