This commit is contained in:
Edwin Eefting 2024-10-15 11:56:56 +02:00
parent 30c81b4f8a
commit 1dd36b77d6
No known key found for this signature in database
GPG Key ID: 0F3C35D8E9887737
2 changed files with 9 additions and 5 deletions

@ -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"):

@ -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."))