Support directory format dump cleanup.
Previously, only deleting a dump in a single-file format was supported. This led to errors when performing a PostgreSQL directory format backup.
This commit is contained in:
parent
5afe0e3d63
commit
8a91c79fb0
1 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
import glob
|
import glob
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
from borgmatic.borg.create import DEFAULT_BORGMATIC_SOURCE_DIRECTORY
|
from borgmatic.borg.create import DEFAULT_BORGMATIC_SOURCE_DIRECTORY
|
||||||
|
|
||||||
|
@ -83,6 +84,9 @@ def remove_database_dumps(dump_path, databases, database_type_name, log_prefix,
|
||||||
if dry_run:
|
if dry_run:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if os.path.isdir(dump_filename):
|
||||||
|
shutil.rmtree(dump_filename)
|
||||||
|
else:
|
||||||
os.remove(dump_filename)
|
os.remove(dump_filename)
|
||||||
dump_file_dir = os.path.dirname(dump_filename)
|
dump_file_dir = os.path.dirname(dump_filename)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue