Fix webhook configuration and formatting

This commit is contained in:
2022-07-06 17:46:27 +00:00
parent 5563f8921f
commit d35e339801
2 changed files with 22 additions and 8 deletions

View File

@ -122,6 +122,7 @@ def read_config():
o_dhcp = o_base["dhcp"]
o_tftp = o_base["tftp"]
o_ansible = o_base["ansible"]
o_notifications = o_base["notifications"]
except KeyError as k:
raise MalformedConfigurationError(f"Missing first-level category {k}")
@ -203,6 +204,15 @@ def read_config():
f"Missing third-level key '{key}' under 'ansible/cspec_files'"
)
# Get the Notifications configuration
for key in ["enabled", "uri", "action", "icons", "body"]:
try:
config[f"notifications_{key}"] = o_notifications[key]
except Exception:
raise MalformedConfigurationError(
f"Missing second-level key '{key}' under 'notifications'"
)
return config