Skip to content

Commit

Permalink
Prevent snapremove ALL from removing snapshots used by clones
Browse files Browse the repository at this point in the history
  • Loading branch information
Defenso-QTH committed Sep 4, 2024
1 parent d4b4621 commit c90040f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion iocage_lib/iocage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2217,7 +2217,13 @@ def snap_remove(self, snapshot, cloned_datasets=None):
print("Snap list =", [s for s in self.snap_list(long=False)])
for snapshot, *_ in reversed(self.snap_list(long=False)):
if not '/' in snapshot:
self.snap_remove(snapshot)
if f"{self.jail}@{snapshot}" in cloned_datasets:
ioc_common.logit({
'level': 'WARNING',
'message': f"Skipped snapshot {self.jail}@{snapshot}: used by clones."
})
else:
self.snap_remove(snapshot)
return
uuid, path = self.__check_jail_existence__()
conf = ioc_json.IOCJson(path, silent=self.silent).json_get_value('all')
Expand Down

0 comments on commit c90040f

Please sign in to comment.