Always call post-snapshot-cmd to clean up faster on snapshot failure

This commit is contained in:
Phil Krylov
2021-06-17 12:38:16 +03:00
parent 082153e0ce
commit 9fc2703638

View File

@ -192,6 +192,7 @@ class ZfsNode(ExecuteNode):
self.verbose("No changes anywhere: not creating snapshots.")
return
try:
for cmd in pre_snapshot_cmd:
self.verbose("Running pre-snapshot-cmd")
self.run(cmd=shlex.split(cmd), readonly=False)
@ -205,9 +206,10 @@ class ZfsNode(ExecuteNode):
self.verbose("Creating snapshots {} in pool {}".format(snapshot_name, pool_name))
self.run(cmd, readonly=False)
finally:
for cmd in post_snapshot_cmd:
self.verbose("Running post-snapshot-cmd")
self.run(cmd=shlex.split(cmd), readonly=False)
self.run(cmd=shlex.split(cmd), readonly=False, valid_exitcodes=[])
def selected_datasets(self, exclude_received, exclude_paths):
"""determine filesystems that should be backupped by looking at the special autobackup-property, systemwide