mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-23 14:41:43 +00:00
also delete security dir when deleting a repo, fixes #3427
This commit is contained in:
parent
e203b8739b
commit
8f772437f2
2 changed files with 9 additions and 1 deletions
|
@ -38,7 +38,7 @@
|
||||||
from .archive import Archive, ArchiveChecker, ArchiveRecreater, Statistics, is_special
|
from .archive import Archive, ArchiveChecker, ArchiveRecreater, Statistics, is_special
|
||||||
from .archive import BackupOSError, backup_io
|
from .archive import BackupOSError, backup_io
|
||||||
from .archive import FilesystemObjectProcessors, MetadataCollector, ChunksProcessor
|
from .archive import FilesystemObjectProcessors, MetadataCollector, ChunksProcessor
|
||||||
from .cache import Cache, assert_secure
|
from .cache import Cache, assert_secure, SecurityManager
|
||||||
from .constants import * # NOQA
|
from .constants import * # NOQA
|
||||||
from .compress import CompressionSpec
|
from .compress import CompressionSpec
|
||||||
from .crypto.key import key_creator, key_argument_names, tam_required_file, tam_required, RepoKey, PassphraseKey
|
from .crypto.key import key_creator, key_argument_names, tam_required_file, tam_required, RepoKey, PassphraseKey
|
||||||
|
@ -1108,6 +1108,7 @@ def _delete_repository(self, args, repository):
|
||||||
return self.exit_code
|
return self.exit_code
|
||||||
repository.destroy()
|
repository.destroy()
|
||||||
logger.info("Repository deleted.")
|
logger.info("Repository deleted.")
|
||||||
|
SecurityManager.destroy(repository)
|
||||||
Cache.destroy(repository)
|
Cache.destroy(repository)
|
||||||
logger.info("Cache deleted.")
|
logger.info("Cache deleted.")
|
||||||
return self.exit_code
|
return self.exit_code
|
||||||
|
|
|
@ -66,6 +66,13 @@ def __init__(self, repository):
|
||||||
self.location_file = os.path.join(self.dir, 'location')
|
self.location_file = os.path.join(self.dir, 'location')
|
||||||
self.manifest_ts_file = os.path.join(self.dir, 'manifest-timestamp')
|
self.manifest_ts_file = os.path.join(self.dir, 'manifest-timestamp')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def destroy(repository, path=None):
|
||||||
|
"""destroy the security dir for ``repository`` or at ``path``"""
|
||||||
|
path = path or get_security_dir(repository.id_str)
|
||||||
|
if os.path.exists(path):
|
||||||
|
shutil.rmtree(path)
|
||||||
|
|
||||||
def known(self):
|
def known(self):
|
||||||
return os.path.exists(self.key_type_file)
|
return os.path.exists(self.key_type_file)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue