another option that is unsupported in older versions

This commit is contained in:
Edwin Eefting 2020-05-17 22:01:12 +02:00
parent 4d15f29b5b
commit 252086e2e6

View File

@ -990,7 +990,7 @@ class ZfsDataset():
#verbose output #verbose output
cmd.append("-v") cmd.append("-v")
if 'extensible_dataset' in features: if 'extensible_dataset' in features and "-s" in self.zfs_node.supported_recv_options:
#support resuming #support resuming
self.debug("Enabled resume support") self.debug("Enabled resume support")
cmd.append("-s") cmd.append("-s")
@ -1355,6 +1355,17 @@ class ZfsNode(ExecuteNode):
ret.append(option) ret.append(option)
return(ret) return(ret)
@cached_property
def supported_recv_options(self):
"""list of supported options"""
#not every zfs implementation supports them all
ret=[]
for option in ["-s" ]:
if self.valid_command(["zfs","recv", option, "zfs_autobackup_option_test"]):
ret.append(option)
return(ret)
def valid_command(self, cmd): def valid_command(self, cmd):
"""test if a specified zfs options are valid exit code. use this to determine support options""" """test if a specified zfs options are valid exit code. use this to determine support options"""