diff --git a/tests/test_zfsautobackup.py b/tests/test_zfsautobackup.py index 2a77e5d..4bdc1bf 100644 --- a/tests/test_zfsautobackup.py +++ b/tests/test_zfsautobackup.py @@ -545,11 +545,10 @@ test_target1/test_source2/fs2/sub@test-20101111000000 canmount - - # should fail, now incompatible self.assertTrue(ZfsAutobackup("test test_target1 --no-progress --verbose --allow-empty".split(" ")).run()) - # FIXME: tries to get the guid of the non existing snapshot because of --test mode with mocktime("20101111000003"): # --test should succeed by destroying incompatibles self.assertFalse(ZfsAutobackup( - "test test_target1 --no-progress --verbose --allow-empty --destroy-incompatible --test --debug".split( + "test test_target1 --no-progress --verbose --allow-empty --destroy-incompatible --test".split( " ")).run()) with mocktime("20101111000003"): diff --git a/zfs_autobackup/ZfsDataset.py b/zfs_autobackup/ZfsDataset.py index 882f943..093c25e 100644 --- a/zfs_autobackup/ZfsDataset.py +++ b/zfs_autobackup/ZfsDataset.py @@ -1116,9 +1116,14 @@ class ZfsDataset: return source_snapshot, target_snapshot # Extensive GUID search (slower but works with all names) - source_bookmark_snapshot = self.find_guid_bookmark_snapshot(target_snapshot.properties['guid']) - if source_bookmark_snapshot is not None: - return source_bookmark_snapshot, target_snapshot + try: + source_bookmark_snapshot = self.find_guid_bookmark_snapshot(target_snapshot.properties['guid']) + if source_bookmark_snapshot is not None: + return source_bookmark_snapshot, target_snapshot + except ExecuteError as e: + # in readonly mode we igore a failed property read for non existing snapshots + if not self.zfs_node.readonly: + raise e raise (Exception("Cant find common bookmark or snapshot with target."))