From 406278632a0a78dd7d5200ee2d76428ea96b0faf Mon Sep 17 00:00:00 2001 From: timeshifter Date: Thu, 2 Dec 2021 14:50:50 +0100 Subject: [PATCH] refactor: ZFS.receive --- zfs-backup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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, )