cache sync: check archive TAM

This commit is contained in:
Thomas Waldmann 2023-06-16 22:40:51 +02:00
parent 52483b26d0
commit 73eae8cc8b
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
2 changed files with 3 additions and 2 deletions

View file

@ -726,7 +726,8 @@ class LocalCache(CacheStatsMixin):
nonlocal processed_item_metadata_chunks
csize, data = decrypted_repository.get(archive_id)
chunk_idx.add(archive_id, 1, len(data), csize)
archive = ArchiveItem(internal_dict=msgpack.unpackb(data))
archive, verified = self.key.unpack_and_verify_archive(data, force_tam_not_required=True)
archive = ArchiveItem(internal_dict=archive)
if archive.version != 1:
raise Exception('Unknown archive metadata version')
sync = CacheSynchronizer(chunk_idx)

View file

@ -1190,7 +1190,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
self.cmd('delete', '--cache-only', self.repository_location)
create_json = json.loads(self.cmd('create', '--no-cache-sync', self.repository_location + '::test', 'input',
'--json', '--error')) # ignore experimental warning
info_json = json.loads(self.cmd('info', self.repository_location + '::test', '--json'))
info_json = json.loads(self.cmd('info', self.repository_location + '::test', '--json', '--error')) # ign warn
create_stats = create_json['cache']['stats']
info_stats = info_json['cache']['stats']
assert create_stats == info_stats