email: Make REJECTED_TEMPORARILY packages be not emailed for

These are rejections that we expect to clear out on their own or convert
to REJECTED_PERMANENTLY, at which point we will email.

https://bugs.launchpad.net/britney/+bug/1671468
master
Iain Lane 7 years ago
parent e00d86ad26
commit 858775a3c1

@ -1579,13 +1579,12 @@ class Britney(object):
# the check fails and we set is_valid to False to block the update; consider
# the age-days hint, if specified for the package
policy_info = excuse.policy_info
policy_verdict = PolicyVerdict.PASS
for policy in self.policies:
if suite in policy.applicable_suites:
v = policy.apply_policy(policy_info, suite, src, source_t, source_u, excuse)
if v > policy_verdict:
policy_verdict = v
if policy_verdict in [PolicyVerdict.REJECTED_PERMANENTLY, PolicyVerdict.REJECTED_TEMPORARILY]:
if v > excuse.current_policy_verdict:
excuse.current_policy_verdict = v
if excuse.current_policy_verdict in [PolicyVerdict.REJECTED_PERMANENTLY, PolicyVerdict.REJECTED_TEMPORARILY]:
excuse.is_valid = False
if suite in ('pu', 'tpu') and source_t:

@ -17,6 +17,8 @@
from collections import defaultdict
import re
from britney2.policies.policy import PolicyVerdict
class Excuse(object):
"""Excuse class
@ -67,6 +69,7 @@ class Excuse(object):
self.missing_builds_ood_arch = set()
self.old_binaries = defaultdict(set)
self.policy_info = {}
self.current_policy_verdict = PolicyVerdict.PASS
def sortkey(self):
if self.daysold == None:

@ -162,7 +162,13 @@ class EmailPolicy(BasePolicy, Rest):
version = source_data_srcdist.version
age = excuse.daysold or 0
rounded_age = int(age)
stuck = age >= 3 and 'block' not in excuse.reason
# an item is stuck if it's
# - old enough
# - not blocked
# - not temporarily rejected (e.g. by the autopkgtest policy when tests
# are still running)
stuck = age >= 3 and 'block' not in excuse.reason and \
excuse.current_policy_verdict != PolicyVerdict.REJECTED_TEMPORARILY
cached = self.cache.get(source_name, {}).get(version)
try:

@ -376,6 +376,24 @@ class ET(TestBase):
self.do_test([pkg], ['foo@bar.com'])
def test_email_not_sent_rejected_temporarily(self):
'''Test that an email is not sent if the package is REJECTED_TEMPORARILY'''
urgency_file = os.path.join(self.data.path,
'data',
'series',
'Urgency')
with open(urgency_file, 'w') as f:
# we specified in setUp() that emergency has a 10 day delay, and
# age rejections are REJECTED_TEMPORARILY
f.write('libc6 2 emergency')
pkg = ('libc6', {'Version': '2',
'Depends': 'notavailable (>= 2)'},
6, # daysold
['foo@bar.com'])
self.do_test([pkg], [])
if __name__ == '__main__':
unittest.main()

Loading…
Cancel
Save