client/securedrop_client/export_status.py (39 lines of code) (raw):

from enum import Enum class ExportError(Exception): def __init__(self, status: "ExportStatus"): self.status: ExportStatus = status class ExportStatus(Enum): """ All possible strings returned by the qrexec calls to sd-devices. These values come from `print/status.py` and `disk/status.py` in `securedrop-export` and must only be changed in coordination with changes released in that component. """ # Export NO_DEVICE_DETECTED = "NO_DEVICE_DETECTED" INVALID_DEVICE_DETECTED = "INVALID_DEVICE_DETECTED" # Multi partitioned, not encrypted, etc MULTI_DEVICE_DETECTED = "MULTI_DEVICE_DETECTED" # Not currently supported UKNOWN_DEVICE_DETECTED = "UNKNOWN_DEVICE_DETECTED" # Badly-formatted USB or VeraCrypt/TC DEVICE_LOCKED = "DEVICE_LOCKED" # One valid device detected, and it's locked DEVICE_WRITABLE = ( "DEVICE_WRITABLE" # One valid device detected, and it's unlocked (and mounted) ) ERROR_UNLOCK_LUKS = "ERROR_UNLOCK_LUKS" ERROR_UNLOCK_GENERIC = "ERROR_UNLOCK_GENERIC" ERROR_MOUNT = "ERROR_MOUNT" # Unlocked but not mounted SUCCESS_EXPORT = "SUCCESS_EXPORT" ERROR_EXPORT = "ERROR_EXPORT" # Could not write to disk # Export succeeds but drives were not properly closed ERROR_EXPORT_CLEANUP = "ERROR_EXPORT_CLEANUP" ERROR_UNMOUNT_VOLUME_BUSY = "ERROR_UNMOUNT_VOLUME_BUSY" DEVICE_ERROR = "DEVICE_ERROR" # Something went wrong while trying to check the device # Print ERROR_MULTIPLE_PRINTERS_FOUND = "ERROR_MULTIPLE_PRINTERS_FOUND" ERROR_PRINTER_NOT_FOUND = "ERROR_PRINTER_NOT_FOUND" ERROR_PRINTER_NOT_SUPPORTED = "ERROR_PRINTER_NOT_SUPPORTED" ERROR_PRINTER_DRIVER_UNAVAILABLE = "ERROR_PRINTER_DRIVER_UNAVAILABLE" ERROR_PRINTER_INSTALL = "ERROR_PRINTER_INSTALL" ERROR_PRINTER_URI = "ERROR_PRINTER_URI" # new # Print error ERROR_PRINT = "ERROR_PRINT" ERROR_UNPRINTABLE_TYPE = "ERROR_UNPRINTABLE_TYPE" ERROR_MIMETYPE_UNSUPPORTED = "ERROR_MIMETYPE_UNSUPPORTED" ERROR_MIMETYPE_DISCOVERY = "ERROR_MIMETYPE_DISCOVERY" # New PRINT_PREFLIGHT_SUCCESS = "PRINTER_PREFLIGHT_SUCCESS" TEST_SUCCESS = "PRINTER_TEST_SUCCESS" PRINT_SUCCESS = "PRINTER_SUCCESS" ERROR_UNKNOWN = "ERROR_GENERIC" # Unknown printer error, backwards-compatible # Misc CALLED_PROCESS_ERROR = "CALLED_PROCESS_ERROR" ERROR_USB_CONFIGURATION = "ERROR_USB_CONFIGURATION" UNEXPECTED_RETURN_STATUS = "UNEXPECTED_RETURN_STATUS" # Client-side error only ERROR_MISSING_FILES = "ERROR_MISSING_FILES" # All files meant for export are missing