Bug 1219768 - make alert_emails field mandatory for new histograms. r=gfritzsche

alert_emails tell us who is interested in a particular histogram. If there's
no one interested, then the histogram shouldn't exist.

MozReview-Commit-ID: 90Yqof3dbsd
This commit is contained in:
Chris H-C 2016-02-23 10:48:13 -05:00
parent 426a56ebc5
commit 160d65e501
2 changed files with 1199 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@ -206,9 +206,11 @@ associated with the histogram. Returns None if no guarding is necessary."""
table_dispatch(definition['kind'], table,
lambda allowed_keys: Histogram.check_keys(name, definition, allowed_keys))
if ('alert_emails' in definition
and not isinstance(definition['alert_emails'], list)):
raise KeyError, 'alert_emails must be an array if present (in Histogram %s)' % name
if 'alert_emails' not in definition:
if whitelists is not None and name not in whitelists['alert_emails']:
raise KeyError, 'New histogram "%s" must have an alert_emails field.' % name
elif not isinstance(definition['alert_emails'], list):
raise KeyError, 'alert_emails must be an array (in histogram "%s")' % name
Histogram.check_name(name)
Histogram.check_field_types(name, definition)