Updated json format

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2024-05-31 20:14:02 +03:00
parent 1e5254535c
commit 48ebec6a4f

View file

@ -28,6 +28,7 @@ class Upgrade(Configs): # pylint: disable=[R0902]
self.load_data = LoadData()
self.id: int = 0
self.log_id: int = 0
self.sum_upgrade: int = 0
self.sum_removed: int = 0
self.sum_added: int = 0
@ -138,13 +139,15 @@ class Upgrade(Configs): # pylint: disable=[R0902]
name (str): Package name.
err (InvalidVersion): InvalidVersion error.
"""
self.log_id += 1
log: dict = {}
if self.upgrade_log_file.is_file():
log: dict = self.utils.read_json_file(self.upgrade_log_file)
log[installed]: dict = {
'repo name': self.repository,
log[self.log_id]: dict = {
'installed': installed,
'repo package': self.data[name]['package'],
'repo name': self.repository,
'error': str(err)
}
self.upgrade_log_file.write_text(json.dumps(log, indent=4), encoding='utf-8')