From 933e0fa75bbf9f7403c9765ffa0aa175e1edc6ad Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Tue, 23 Apr 2024 12:25:24 +0200 Subject: [PATCH] return result when validating config settings and show result on console --- eessi_bot_event_handler.py | 6 +++++- eessi_bot_job_manager.py | 6 +++++- tools/config.py | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/eessi_bot_event_handler.py b/eessi_bot_event_handler.py index fa8bb062..ff36614d 100644 --- a/eessi_bot_event_handler.py +++ b/eessi_bot_event_handler.py @@ -609,7 +609,11 @@ def main(): opts = event_handler_parse() # config is read and checked for settings to raise an exception early when the event_handler starts. - config.check_required_cfg_settings(REQUIRED_CONFIG) + if config.check_required_cfg_settings(REQUIRED_CONFIG) == True: + print("Configuration check: PASSED") + else: + print("Configuration check: FAILED") + sys.exit(1) github.connect() if opts.file: diff --git a/eessi_bot_job_manager.py b/eessi_bot_job_manager.py index e754059d..42f95cfe 100644 --- a/eessi_bot_job_manager.py +++ b/eessi_bot_job_manager.py @@ -577,7 +577,11 @@ def main(): # config is read and checked for settings to raise an exception early when # the job_manager runs - config.check_required_cfg_settings(REQUIRED_CONFIG) + if config.check_required_cfg_settings(REQUIRED_CONFIG) == True: + print("Configuration check: PASSED") + else: + print("Configuration check: FAILED") + sys.exit(1) github.connect() job_manager = EESSIBotSoftwareLayerJobManager() diff --git a/tools/config.py b/tools/config.py index 0a325950..dcffe03d 100644 --- a/tools/config.py +++ b/tools/config.py @@ -151,3 +151,4 @@ def check_required_cfg_settings(req_settings, path="app.cfg"): for item in req_settings[section]: if item not in cfg[section]: error(f'Missing configuration item "{item}" in section "{section}" of configuration file {path}.') + return True