diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2020-05-28 17:06:04 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2020-05-28 17:17:10 +0300 |
commit | 4f7df6cac9c32c6b2357b245d0b9c4069369f5a3 (patch) | |
tree | adf0242d824c38ee5acead17fae376ad8a6d1c75 | |
parent | 2e66e6c8d57f6c637ce2cd896a5fe1b8a713e9a7 (diff) |
Allow maintainers to suppress informative-only mail
If the !email file contains a line saying 'quiet', the log output will
not be mailed if the log only contains INFO severity messages.
-rwxr-xr-x | calm/calm.py | 3 | ||||
-rw-r--r-- | calm/maintainers.py | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/calm/calm.py b/calm/calm.py index 1757da3..88ebdd7 100755 --- a/calm/calm.py +++ b/calm/calm.py @@ -141,7 +141,8 @@ def process_uploads(args, state): m = mlist[name] # also send a mail to each maintainer about their packages - with mail_logs(args.email, toaddrs=m.email, subject='%s for %s' % (state.subject, name), thresholdLevel=logging.INFO) as maint_email: # noqa: F841 + threshold = logging.WARNING if m.quiet else logging.INFO + with mail_logs(args.email, toaddrs=m.email, subject='%s for %s' % (state.subject, name), thresholdLevel=threshold, retainLevel=logging.INFO) as maint_email: # noqa: F841 # for each arch and noarch scan_result = {} diff --git a/calm/maintainers.py b/calm/maintainers.py index 16b219c..9d7bdee 100644 --- a/calm/maintainers.py +++ b/calm/maintainers.py @@ -65,6 +65,7 @@ class Maintainer(object): self.name = name self.email = email self.pkgs = pkgs + self.quiet = False # the mtime of this file records the timestamp reminder_file = os.path.join(self.homedir(), '!reminder-timestamp') @@ -113,6 +114,7 @@ def add_directories(mlist, homedirs): m = Maintainer._find(mlist, n) + # !mail is the deprecated historical alternative for e in ['!email', '!mail']: email = os.path.join(homedirs, m.name, e) if os.path.isfile(email): @@ -122,7 +124,9 @@ def add_directories(mlist, homedirs): if l.startswith('#'): continue l = l.strip() - if l: + if l.lower() == 'quiet': + m.quiet = True + elif l: m.email.append(l) if not m.email: logging.error("no email address known for maintainer '%s'" % (m.name)) |