Overwrite snapshot if slug allready exsist (#2146)

This commit is contained in:
Joakim Sørensen 2020-10-19 13:57:58 +02:00 committed by GitHub
parent c6e3787681
commit 9744f3354b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,8 +98,10 @@ class SnapshotManager(CoreSysAttributes):
# Already exists?
if snapshot.slug in self.snapshots_obj:
_LOGGER.error("Snapshot %s already exists!", snapshot.slug)
return None
_LOGGER.warning(
"Snapshot %s already exists! overwriting snapshot", snapshot.slug
)
self.remove(self.get(snapshot.slug))
# Move snapshot to backup
tar_origin = Path(self.sys_config.path_backup, f"{snapshot.slug}.tar")