Use empty username when username is not present

in snapshot.

This commit is fixing a crash when the snapshot has
no username field in JSON. The missing username is
replaced with a space.
This commit is contained in:
Enrico204 2023-02-06 13:52:07 +01:00
parent 880b47131c
commit 011b658805

View file

@ -117,7 +117,7 @@ class ResticCollector(object):
clients.append({
'snapshot_hash': snap['hash'],
'hostname': snap['hostname'],
'username': snap['username'],
'username': snap['username'] if 'username' in snap else '',
'timestamp': timestamp,
'size_total': stats['total_size'],
'files_total': stats['total_file_count'],