mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-01 04:37:34 +00:00
borg info <repo>: print general repo information (#1680)
This commit is contained in:
parent
4229e77e97
commit
27bc73c23e
2 changed files with 16 additions and 2 deletions
|
@ -920,7 +920,7 @@ def do_info(self, args, repository, manifest, key, cache):
|
|||
if any((args.location.archive, args.first, args.last, args.prefix)):
|
||||
return self._info_archives(args, repository, manifest, key, cache)
|
||||
else:
|
||||
return self._info_repository(cache)
|
||||
return self._info_repository(repository, key, cache)
|
||||
|
||||
def _info_archives(self, args, repository, manifest, key, cache):
|
||||
def format_cmdline(cmdline):
|
||||
|
@ -957,7 +957,17 @@ def format_cmdline(cmdline):
|
|||
print()
|
||||
return self.exit_code
|
||||
|
||||
def _info_repository(self, cache):
|
||||
def _info_repository(self, repository, key, cache):
|
||||
print('Repository ID: %s' % bin_to_hex(repository.id))
|
||||
if key.NAME == 'plaintext':
|
||||
encrypted = 'No'
|
||||
else:
|
||||
encrypted = 'Yes (%s)' % key.NAME
|
||||
print('Encrypted: %s' % encrypted)
|
||||
if key.NAME == 'key file':
|
||||
print('Key file: %s' % key.find_key())
|
||||
print('Cache: %s' % cache.path)
|
||||
print(DASHES)
|
||||
print(STATS_HEADER)
|
||||
print(str(cache))
|
||||
return self.exit_code
|
||||
|
|
|
@ -118,6 +118,7 @@ def assert_id(self, id, data):
|
|||
|
||||
class PlaintextKey(KeyBase):
|
||||
TYPE = 0x02
|
||||
NAME = 'plaintext'
|
||||
|
||||
chunk_seed = 0
|
||||
|
||||
|
@ -281,6 +282,7 @@ class PassphraseKey(AESKeyBase):
|
|||
# - --encryption=passphrase is an invalid argument now
|
||||
# This class is kept for a while to support migration from passphrase to repokey mode.
|
||||
TYPE = 0x01
|
||||
NAME = 'passphrase'
|
||||
iterations = 100000 # must not be changed ever!
|
||||
|
||||
@classmethod
|
||||
|
@ -432,6 +434,7 @@ def get_new_target(self, args):
|
|||
|
||||
class KeyfileKey(KeyfileKeyBase):
|
||||
TYPE = 0x00
|
||||
NAME = 'key file'
|
||||
FILE_ID = 'BORG_KEY'
|
||||
|
||||
def sanity_check(self, filename, id):
|
||||
|
@ -491,6 +494,7 @@ def save(self, target, passphrase):
|
|||
|
||||
class RepoKey(KeyfileKeyBase):
|
||||
TYPE = 0x03
|
||||
NAME = 'repokey'
|
||||
|
||||
def find_key(self):
|
||||
loc = self.repository._location.canonical_path()
|
||||
|
|
Loading…
Reference in a new issue