configure weather we send email to task and package owners on success. still send email to watchers

This commit is contained in:
Dennis Gilmore 2009-01-08 17:40:01 -06:00 committed by Dennis Gilmore
parent 46f20d36c8
commit 7b867ca424
2 changed files with 12 additions and 8 deletions

View file

@ -38,6 +38,8 @@ KojiWebURL = http://kojiweb.example.com/koji
# The domain name that will be appended to Koji usernames
# when creating email notifications
#EmailDomain = example.com
# weather to send the task owner and package owner email or not on success. this still goes to watchers
NotifyOnSuccess = True
## If KojiDebug is on, the hub will be /very/ verbose and will report exception
## details to clients for anticipated errors (i.e. koji's own exceptions --

View file

@ -3919,16 +3919,18 @@ def get_notification_recipients(build, tag_id, state):
emails = [result[0] for result in query.execute()]
email_domain = context.opts['EmailDomain']
notify_on_success = context.opts['NotifyOnSuccess']
# user who submitted the build
emails.append('%s@%s' % (build['owner_name'], email_domain))
if notify_on_success is True or state != koji.BUILD_STATES['COMPLETE']::
# user who submitted the build
emails.append('%s@%s' % (build['owner_name'], email_domain))
if tag_id:
packages = readPackageList(pkgID=package_id, tagID=tag_id, inherit=True)
# owner of the package in this tag, following inheritance
emails.append('%s@%s' % (packages[package_id]['owner_name'], email_domain))
#FIXME - if tag_id is None, we don't have a good way to get the package owner.
# using all package owners from all tags would be way overkill.
if tag_id:
packages = readPackageList(pkgID=package_id, tagID=tag_id, inherit=True)
# owner of the package in this tag, following inheritance
emails.append('%s@%s' % (packages[package_id]['owner_name'], email_domain))
#FIXME - if tag_id is None, we don't have a good way to get the package owner.
# using all package owners from all tags would be way overkill.
emails_uniq = dict(zip(emails, [1] * len(emails))).keys()
return emails_uniq