Rather than allow operators to not specify any email, I added the ability here to allow the administrators to disable notifications either globally or by service. There are three methods to disable notifications, in order of precedence:
Flag: using the --dont-notify or --disable-notifications flag. This will override (2) and (3), and will disable all notifications for that run.
Configuration at service-level: This is accomplished using the disableNotificationsOverride entry, set to true/false in the role-level configuration in the configuration file.
Configuration at the global-level: This is accomplished using the disableNotifications entry in the configuration file.
Details on precedence
(1) above is simple - it always wins if either version of that flag is set, and no notifications will be sent.
(2) and (3) are a little tricky. The default behavior is to always send notifications (disableNotifications is unset or false in configuration file). Here is a table of possible global and service-level values of disableNotifications and disableNotificationsOverride, and the resultant behavior of whether the code will send Admin or Service level notifications.
disableNotifications
disableNotificationsOverride
Admin Notifications Sent
Service-level notifications sent
unset/false
unset/false
yes
yes
unset/false
true
yes (but not for disabled service)
no
true
unset
no
no
true
true
no
no
true
false
yes (for only overridden service)
yes
Note that in the above table, overrides can be set on more than one service, and these rules apply equally to all services. So, for example, in a three-service configuration, if notifications are disabled globally, but two services indicate that notifications should be sent disableNotificationsOverride: false, then the admin notifications are sent for ONLY those two services, and the service notifications are sent for those services as well. The admin notifications will not contain any errors for the third service, and a service level email for that third service will not be sent.
Testing
Unit tests - PASS
"Integration tests" - PASS
Regular config file - Standard configuration with three experiments, with deliberate errors to check error handling
Block some notifications from being sent via config file (only one service allowed through) - should result in admin, one service notification. Admin notification should only contain information from the one enabled service.
Block all notifications globally via config - no notifications should be sent
Block only one service via config - other two services should have notifications sent, along with admin notification containing other two services' errors
Command-line flags with all of the cases above. In ALL cases, notifications should not be sent, whether or not the test configuration files have notifications blocked or not.
Closes #92
Summary
Rather than allow operators to not specify any email, I added the ability here to allow the administrators to disable notifications either globally or by service. There are three methods to disable notifications, in order of precedence:
--dont-notify
or--disable-notifications
flag. This will override (2) and (3), and will disable all notifications for that run.disableNotificationsOverride
entry, set totrue/false
in the role-level configuration in the configuration file.disableNotifications
entry in the configuration file.Details on precedence
(1) above is simple - it always wins if either version of that flag is set, and no notifications will be sent.
(2) and (3) are a little tricky. The default behavior is to always send notifications (
disableNotifications
is unset orfalse
in configuration file). Here is a table of possible global and service-level values ofdisableNotifications
anddisableNotificationsOverride
, and the resultant behavior of whether the code will send Admin or Service level notifications.Note that in the above table, overrides can be set on more than one service, and these rules apply equally to all services. So, for example, in a three-service configuration, if notifications are disabled globally, but two services indicate that notifications should be sent
disableNotificationsOverride: false
, then the admin notifications are sent for ONLY those two services, and the service notifications are sent for those services as well. The admin notifications will not contain any errors for the third service, and a service level email for that third service will not be sent.Testing