INNER CODE UNIT · Python

_run_lifecyle_hook

Minituff/nautical-backup · app/backup.py:435

    def _run_lifecyle_hook(self, c: Container, when: BeforeOrAfter):
        """Runs a commend inside the child container"""
        if when == BeforeOrAfter.BEFORE:
            command = str(self.get_label(c, "lifecycle.before", ""))
            timeout = str(self.get_label(c, "lifecycle.before.timeout", "60"))
            if command and command != "":
                self.log_this("Running DURING-backup lifecycle hook for $name", "DEBUG")
        elif when == BeforeOrAfter.AFTER:
            timeout = str(self.get_label(c, "lifecycle.after.timeout", "60"))
            command = str(self.get_label(c, "lifecycle.after", ""))
            if command and command != "":
                self.log_this("Running AFTER-backup lifecycle hook for $name", "DEBUG")
        else:
            return
        if not command or command == "":
            return None

        command = f"timeout {timeout} " + command

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…