From 51258613cc07ca8f6def8d0d15f6152d85a4c652 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Thu, 12 Sep 2024 14:08:53 +0200 Subject: src: verify the fields of the efibootmgr json in /refresh Don't send the efi data in the /refresh payload if efibootmgr is missing any of the json keys. Log the missing keys in case of missing some. --- src/live/ogOperations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/live') diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index 9c32cce..c51215c 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -164,7 +164,7 @@ class OgLiveOperations: return data try: - efibootmgr_out = run_efibootmgr_json() + efibootmgr_out = run_efibootmgr_json(validate=True) except Exception as e: logging.warning(e) return data @@ -172,8 +172,8 @@ class OgLiveOperations: data['entries'] = [] for idx, entry_name in enumerate(efibootmgr_out['BootOrder']): entry_name = 'Boot' + entry_name - for entry in efibootmgr_out['vars']: - if entry['name'] == entry_name: + for entry in efibootmgr_out.get('vars', []): + if entry.get('name', '') == entry_name: entry['order'] = idx data['entries'].append(entry) break -- cgit v1.2.3-18-g5258