use email namespace in configuration

This is for all configuration related to sending emails, not for e.g.
the default QA contact. By chance, it fixes a problem in the default
configuration where the mail templates ended up in the pdc_types
subtree.

Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
Nils Philippsen 2019-11-22 16:42:04 +01:00
parent 7821f08e2e
commit 78434ffbfd
2 changed files with 22 additions and 21 deletions

View file

@ -1,11 +1,9 @@
environment = "staging"
send_email = false
email_from = "accounts@fedoraproject.org"
data_cache = "/var/tmp/pagure_sync_bz.json"
notify_emails = [
"root@localhost.localdomain",
]
bz_maintainer_change_comment = """
This package has changed maintainer in the Fedora.
Reassigning to the new maintainer of this component.
"""
[products]
"Fedora" = "Fedora"
@ -29,22 +27,23 @@ notify_emails = [
"modules" = "module"
"container" = "container"
bz_maintainer_change_comment = """
This package has changed maintainer in the Fedora.
Reassigning to the new maintainer of this component.
"""
[email]
send_mails = false
from = "accounts@fedoraproject.org"
notify_admins = [
"root@localhost.localdomain",
]
## EMAIL TEMPLATES
tmpl_admin_email = """
[email.templates]
admin_notification = """
The following errors were encountered while updating bugzilla with information
from the Package Database. Please have the problems taken care of:
{errors}
"""
# User email for invalid setup
tmpl_user_email = """Greetings.
# User email for invalid setup
user_notification = """Greetings.
You are receiving this email because there's a problem with your
bugzilla.redhat.com account.

View file

@ -561,11 +561,11 @@ class DistgitBugzillaSync:
if notify_user:
send_email(
self.env['email_from'],
self.env['email']['from'],
[user_email],
subject='Please fix your bugzilla.redhat.com account',
message=self.env['tmpl_user_email'],
cc_address=self.env['notify_emails'],
message=self.env['email']['templates']['user_notification'],
cc_address=self.env['email']['notify_admins'],
)
new_data[user_email] = {
@ -875,10 +875,12 @@ class DistgitBugzillaSync:
else:
self.notify_users(errors)
send_email(
self.env['email_from'],
self.env['notify_emails'],
self.env['email']['from'],
self.env['email']['notify_admins'],
'Errors while syncing bugzilla with the PackageDB',
self.env['tmpl_admin_email'].format(errors='\n'.join(errors))
self.env['email']['templates']['admin_notification'].format(
errors='\n'.join(errors)
)
)
else:
with open(self.env['data_cache'], 'w') as stream: