From 48ff1f7d2f0cb76334da4fb85056300a761c7d82 Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Sat, 9 Nov 2019 23:18:24 +0100 Subject: [PATCH] destroys no longer fatal --- zfs_autobackup | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/zfs_autobackup b/zfs_autobackup index 9706dc1..f012703 100755 --- a/zfs_autobackup +++ b/zfs_autobackup @@ -626,11 +626,19 @@ class ZfsDataset(): self.exists=1 - def destroy(self): + def destroy(self, fail_exception=False): + """destroy the dataset. by default failures are not an exception, so we can continue making backups""" self.verbose("Destroying") - self.zfs_node.run(["zfs", "destroy", self.name]) - self.invalidate() - self.force_exists=False + try: + self.zfs_node.run(["zfs", "destroy", self.name]) + self.invalidate() + self.force_exists=False + return(True) + except: + if not fail_exception: + return(False) + else: + raise @cached_property