diff --git a/zfs-backup.py b/zfs-backup.py index 95ce5da..59a61d6 100755 --- a/zfs-backup.py +++ b/zfs-backup.py @@ -266,13 +266,14 @@ class ZFS: return sender @staticmethod - # TODO pool_name --> pool: Pool - def receive(stream: Popen[str], pool_name): + def receive(stream: Popen[str], pool: Pool): # -d Discard the first element of the sent snapshot's file system name # -F Force a rollback of the file system to the most recent snapshot before performing the receive operation. # -u File system that is associated with the received stream is not mounted. + if not isinstance(pool, Pool): + raise TypeError("Can only receive into pools.") check_output( - [config.ZFS, "receive", "-d", "-F", "-u", pool_name], + [config.ZFS, "receive", "-d", "-F", "-u", pool.name], stdin=stream.stdout, )