Skip to content

Commit

Permalink
return result when validating config settings and show result on console
Browse files Browse the repository at this point in the history
  • Loading branch information
truib committed Apr 23, 2024
1 parent 13a9a18 commit 933e0fa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion eessi_bot_event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion eessi_bot_job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 933e0fa

Please sign in to comment.