INNER CODE UNIT · Python
_stop_container
Minituff/nautical-backup · app/backup.py:457
def _stop_container(self, c: Container, attempt=1) -> bool:
c.reload() # Refresh the status for this container
SKIP_STOPPING = self.env.SKIP_STOPPING
skip_stopping_set = set(SKIP_STOPPING.split(","))
if c.name in skip_stopping_set or c.id in skip_stopping_set:
self.log_this(f"Container {c.name} is in SKIP_STOPPING list. Will not stop container.", "DEBUG")
return True
stop_before_backup = str(self.get_label(c, "stop-before-backup", "true"))
if stop_before_backup.lower() == "false":
self.log_this(f"Skipping stopping of {c.name} because of label", "DEBUG")
return True
if c.status != "running":
self.log_this(f"Container {c.name} was not running. No need to stop.", "DEBUG")
return True
stop_timeout = str(self.get_label(c, "stop-timeout", str(self.env.STOP_TIMEOUT)))