From bd84a69537a4a1ba13becd52ca5d5162037e26f2 Mon Sep 17 00:00:00 2001 From: Alexander Zaft Date: Tue, 6 Aug 2024 14:58:07 +0200 Subject: [PATCH] lib: GeneralConfig fix missing keys logic Change-Id: I814511fff6fbf7c94e30a052bff0712fad9805b5 Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/34306 Reviewed-by: Alexander Zaft Tested-by: Jenkins Automated Tests --- frappy/lib/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frappy/lib/__init__.py b/frappy/lib/__init__.py index 378b250..6dd882f 100644 --- a/frappy/lib/__init__.py +++ b/frappy/lib/__init__.py @@ -109,7 +109,10 @@ class GeneralConfig: for key in mandatory: if (env := environ.get(f'FRAPPY_{key.upper()}')) is not None: cfg[key] = env - missing_keys = [key for key in mandatory if self[key] is None] + missing_keys = [ + key for key in mandatory + if cfg.get(key) is None and self.defaults.get(key) is None + ] if missing_keys: if configfile: raise KeyError(f"missing value for {' and '.join(missing_keys)} in {configfile}")