borg info <repo>: print general repo information (#1680)

This commit is contained in:
enkore 2016-10-03 14:53:16 +02:00 committed by GitHub
parent 4229e77e97
commit 27bc73c23e
2 changed files with 16 additions and 2 deletions

View File

@ -920,7 +920,7 @@ class Archiver:
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 @@ class Archiver:
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

View File

@ -118,6 +118,7 @@ class KeyBase:
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 @@ class KeyfileKeyBase(AESKeyBase):
class KeyfileKey(KeyfileKeyBase):
TYPE = 0x00
NAME = 'key file'
FILE_ID = 'BORG_KEY'
def sanity_check(self, filename, id):
@ -491,6 +494,7 @@ class KeyfileKey(KeyfileKeyBase):
class RepoKey(KeyfileKeyBase):
TYPE = 0x03
NAME = 'repokey'
def find_key(self):
loc = self.repository._location.canonical_path()