outposts: improve logging for outpost controllers

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-12-11 15:35:20 +01:00
parent 6791436302
commit bafeff7306
2 changed files with 5 additions and 0 deletions

View File

@ -230,7 +230,9 @@ class DockerController(BaseController):
try: try:
container, _ = self._get_container() container, _ = self._get_container()
if container.status == "running": if container.status == "running":
self.logger.info("Stopping container.")
container.kill() container.kill()
self.logger.info("Removing container.")
container.remove(force=True) container.remove(force=True)
except DockerException as exc: except DockerException as exc:
raise ControllerException(str(exc)) from exc raise ControllerException(str(exc)) from exc

View File

@ -105,9 +105,12 @@ def outpost_controller(
logs = [] logs = []
if from_cache: if from_cache:
outpost: Outpost = cache.get(CACHE_KEY_OUTPOST_DOWN % outpost_pk) outpost: Outpost = cache.get(CACHE_KEY_OUTPOST_DOWN % outpost_pk)
LOGGER.debug("Getting outpost from cache to delete")
else: else:
outpost: Outpost = Outpost.objects.filter(pk=outpost_pk).first() outpost: Outpost = Outpost.objects.filter(pk=outpost_pk).first()
LOGGER.debug("Getting outpost from DB")
if not outpost: if not outpost:
LOGGER.warning("No outpost")
return return
self.set_uid(slugify(outpost.name)) self.set_uid(slugify(outpost.name))
try: try: