INNER CODE UNIT · Python

get_label

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

    def get_label(self, container: Container, target: str, default=None):
        """Apply the label prefix and return the label value
        By default the label will look like: `nautical-backup.enable`
        """
        return container.labels.get(f"{self.prefix}.{target}", default)

    def verify_nautical_mounted_source_location(self, src_dir: str):
        self.log_this(f"Verifying source directory '{src_dir}'...", "DEBUG", LogType.INIT)
        if not os.path.isdir(src_dir):
            self.log_this(f"Source directory '{src_dir}' does not exist.", "ERROR", LogType.INIT)
            raise FileNotFoundError(f"Source directory '{src_dir}' does not exist.")
        elif not os.access(src_dir, os.R_OK):
            self.log_this(f"No read access to source directory '{src_dir}'.", "ERROR", LogType.INIT)
            raise PermissionError(f"No read access to source directory '{src_dir}'")

        self.log_this(f"Source directory '{src_dir}' READ access verified", "TRACE", LogType.INIT)

    def verify_nautical_mounted_destination_location(self, dest_dir: Union[str, Path], create_if_not_exists=True):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…