mirror of https://github.com/borgbackup/borg.git
Merge pull request #3455 from ThomasWaldmann/borg-delete-removing-security-dir-1.1
also delete security dir when deleting a repo, fixes #3427 (1.1)
This commit is contained in:
commit
ed31ea2516
|
@ -38,7 +38,7 @@ from . import shellpattern
|
|||
from .algorithms.checksums import crc32
|
||||
from .archive import Archive, ArchiveChecker, ArchiveRecreater, Statistics, is_special
|
||||
from .archive import BackupOSError, backup_io
|
||||
from .cache import Cache, assert_secure
|
||||
from .cache import Cache, assert_secure, SecurityManager
|
||||
from .constants import * # NOQA
|
||||
from .compress import CompressionSpec
|
||||
from .crypto.key import key_creator, key_argument_names, tam_required_file, tam_required, RepoKey, PassphraseKey
|
||||
|
@ -1303,6 +1303,7 @@ class Archiver:
|
|||
return self.exit_code
|
||||
repository.destroy()
|
||||
logger.info("Repository deleted.")
|
||||
SecurityManager.destroy(repository)
|
||||
Cache.destroy(repository)
|
||||
logger.info("Cache deleted.")
|
||||
return self.exit_code
|
||||
|
|
|
@ -66,6 +66,13 @@ class SecurityManager:
|
|||
self.location_file = os.path.join(self.dir, 'location')
|
||||
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):
|
||||
return os.path.exists(self.key_type_file)
|
||||
|
||||
|
|
Loading…
Reference in New Issue