Always call post-snapshot-cmd to clean up faster on snapshot failure
This commit is contained in:
@ -192,22 +192,24 @@ class ZfsNode(ExecuteNode):
|
|||||||
self.verbose("No changes anywhere: not creating snapshots.")
|
self.verbose("No changes anywhere: not creating snapshots.")
|
||||||
return
|
return
|
||||||
|
|
||||||
for cmd in pre_snapshot_cmd:
|
try:
|
||||||
self.verbose("Running pre-snapshot-cmd")
|
for cmd in pre_snapshot_cmd:
|
||||||
self.run(cmd=shlex.split(cmd), readonly=False)
|
self.verbose("Running pre-snapshot-cmd")
|
||||||
|
self.run(cmd=shlex.split(cmd), readonly=False)
|
||||||
|
|
||||||
# create consistent snapshot per pool
|
# create consistent snapshot per pool
|
||||||
for (pool_name, snapshots) in pools.items():
|
for (pool_name, snapshots) in pools.items():
|
||||||
cmd = ["zfs", "snapshot"]
|
cmd = ["zfs", "snapshot"]
|
||||||
|
|
||||||
cmd.extend(map(lambda snapshot_: str(snapshot_), snapshots))
|
cmd.extend(map(lambda snapshot_: str(snapshot_), snapshots))
|
||||||
|
|
||||||
self.verbose("Creating snapshots {} in pool {}".format(snapshot_name, pool_name))
|
self.verbose("Creating snapshots {} in pool {}".format(snapshot_name, pool_name))
|
||||||
self.run(cmd, readonly=False)
|
self.run(cmd, readonly=False)
|
||||||
|
|
||||||
for cmd in post_snapshot_cmd:
|
finally:
|
||||||
self.verbose("Running post-snapshot-cmd")
|
for cmd in post_snapshot_cmd:
|
||||||
self.run(cmd=shlex.split(cmd), readonly=False)
|
self.verbose("Running post-snapshot-cmd")
|
||||||
|
self.run(cmd=shlex.split(cmd), readonly=False, valid_exitcodes=[])
|
||||||
|
|
||||||
def selected_datasets(self, exclude_received, exclude_paths):
|
def selected_datasets(self, exclude_received, exclude_paths):
|
||||||
"""determine filesystems that should be backupped by looking at the special autobackup-property, systemwide
|
"""determine filesystems that should be backupped by looking at the special autobackup-property, systemwide
|
||||||
|
|||||||
Reference in New Issue
Block a user