INNER CODE UNIT · Python

verify_nautical_mounted_destination_location

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

    def verify_nautical_mounted_destination_location(self, dest_dir: Union[str, Path], create_if_not_exists=True):
        self.log_this(f"Verifying Nautical destination directory '{dest_dir}'...", "DEBUG", LogType.INIT)

        if not os.path.exists(dest_dir) and create_if_not_exists:
            os.makedirs(dest_dir, exist_ok=True)

        if not os.path.isdir(dest_dir):
            self.log_this(
                f"Destination directory '{dest_dir}' does not exist. Please mount it to /app/destination",
                "ERROR",
                LogType.INIT,
            )
            raise FileNotFoundError(f"Destination directory '{dest_dir}' does not exist.")
        elif not os.access(dest_dir, os.R_OK):
            self.log_this(f"No read access to destination directory '{dest_dir}'.", "ERROR", LogType.INIT)
            raise PermissionError(f"No read access to destination directory '{dest_dir}'")
        elif not os.access(dest_dir, os.W_OK):
            self.log_this(f"No write access to destination directory '{dest_dir}'.", "ERROR", LogType.INIT)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…