diff --git a/zfs-backup.py b/zfs-backup.py index 44d8541..72dcf13 100755 --- a/zfs-backup.py +++ b/zfs-backup.py @@ -278,13 +278,14 @@ class ZFS: ) @staticmethod - def scrub(pool: str, *, wait_for_finish=True) -> None: + def scrub(pool: Pool, *, wait_for_finish: bool = True) -> None: + if not isinstance(pool, Pool): + raise TypeError("Can only scrub pools.") # TODO: check if scrub already in progress - run_command([config.ZPOOL, "scrub", pool]) + run_command([config.ZPOOL, "scrub", pool.name]) if wait_for_finish: # TODO make Ctrl-c interrupt this - run_command([config.ZPOOL, "wait", "-t", "scrub", pool]) - + run_command([config.ZPOOL, "wait", "-t", "scrub", pool.name]) # TODO raise error if pool is not healthy @@ -373,7 +374,7 @@ class ExternalPool(Pool): def scrub(self) -> None: print(f"Scrubbing {self._name}") - ZFS.scrub(self._name) + ZFS.scrub(self) @classmethod def find_from_dict(cls, backup_pools: dict[str, UUID]) -> ExternalPool: