From 2a609f6eb713f31ff4ad22270df6d9c0b6108b59 Mon Sep 17 00:00:00 2001 From: bigeagle Date: Fri, 24 Oct 2014 00:51:30 +0800 Subject: [PATCH] btrfs only commit when job succeeded --- tunasync/btrfs_snapshot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tunasync/btrfs_snapshot.py b/tunasync/btrfs_snapshot.py index 615eaad..91b179b 100644 --- a/tunasync/btrfs_snapshot.py +++ b/tunasync/btrfs_snapshot.py @@ -20,8 +20,9 @@ class BtrfsHook(JobHook): def before_job(self, *args, **kwargs): self._create_working_snapshot() - def after_job(self, *args, **kwargs): - self._commit_changes() + def after_job(self, status=None, *args, **kwargs): + if status == "success": + self._commit_changes() def _ensure_subvolume(self): # print(self.service_dir)