refactor: ZFS.receive

This commit is contained in:
timeshifter
2021-12-02 14:50:50 +01:00
parent 17057806f3
commit 406278632a
+4 -3
View File
@@ -266,13 +266,14 @@ class ZFS:
return sender return sender
@staticmethod @staticmethod
# TODO pool_name --> pool: Pool def receive(stream: Popen[str], pool: Pool):
def receive(stream: Popen[str], pool_name):
# -d Discard the first element of the sent snapshot's file system name # -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. # -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. # -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( check_output(
[config.ZFS, "receive", "-d", "-F", "-u", pool_name], [config.ZFS, "receive", "-d", "-F", "-u", pool.name],
stdin=stream.stdout, stdin=stream.stdout,
) )