templates_messagesdir = $(templatesdir)/messages
+dist_templates_messages_jobs_DATA = \
+ src/templates/messages/jobs/failed.markdown \
+ src/templates/messages/jobs/finished.markdown
+
+templates_messages_jobsdir = $(templates_messagesdir)/jobs
+
dist_templates_messages_users_DATA = \
src/templates/messages/users/account-activation.markdown \
src/templates/messages/users/email-activation.markdown
"Makefile",
)
-N_ = lambda x: x
-
-MSG_BUILD_FAILED_SUBJECT = N_("[%(build_name)s] Build job failed.")
-MSG_BUILD_FAILED = N_("""\
-The build job "%(build_name)s" has failed.
-
-This could have a couple of reasons and needs to be investigated by you.
-
-Here is more information about the incident:
-
- Build name: %(build_name)s
- Build host: %(build_host)s
-
-Click on this link to get all details about the build:
- https://pakfire.ipfire.org/job/%(build_uuid)s
-
-Sincerely,
- The Pakfire Build Service""")
-
-
-MSG_BUILD_FINISHED_SUBJECT = N_("[%(build_name)s] Build job finished.")
-MSG_BUILD_FINISHED = N_("""\
-The build job "%(build_name)s" has finished.
-
-If you are the maintainer, it is up to you to push it to one or more repositories.
-
-Click on this link to get all details about the build:
- https://pakfire.ipfire.org/job/%(build_uuid)s
-
-Sincerely,
- The Pakfire Build Service""")
-
# Bug update messages.
BUG_TESTING_MSG = """\
%(package_name)s has been pushed to the %(distro_name)s %(repo_name)s repository.
logging.debug("Sending finished message for job %s to %s" % \
(self.name, ", ".join(self.message_recipients)))
- info = {
- "build_name" : self.name,
- "build_host" : self.builder.name,
- "build_uuid" : self.uuid,
- }
-
- self.backend.messages.send_to_all(self.message_recipients,
- MSG_BUILD_FINISHED_SUBJECT, MSG_BUILD_FINISHED, info)
+ self.backend.messages.send_template_to_many(self.message_recipients,
+ "messages/jobs/finished", job=self)
def send_failed_message(self):
logging.debug("Sending failed message for job %s to %s" % \
(self.name, ", ".join(self.message_recipients)))
- build_host = "--"
- if self.builder:
- build_host = self.builder.name
-
- info = {
- "build_name" : self.name,
- "build_host" : build_host,
- "build_uuid" : self.uuid,
- }
-
- self.backend.messages.send_to_all(self.message_recipients,
- MSG_BUILD_FAILED_SUBJECT, MSG_BUILD_FAILED, info)
+ self.backend.messages.send_template_to_many(self.message_recipients,
+ "messages/jobs/failed", job=self)
def get_build_repos(self):
"""
# Send the message
self.send_to(user.email.recipient if user else recipient, message, sender=sender, headers=headers)
+ def send_template_to_many(self, recipients, *args, **kwargs):
+ for recipient in recipients:
+ self.send_template(recipient, *args, **kwargs)
+
def queue(self, message):
res = self.db.get("INSERT INTO messages(message) VALUES(%s) RETURNING id", message)
--- /dev/null
+Subject: [{{ job.name }}] {{ _("Build job failed") }}
+
+{{ _("The build job %s has failed") % job.name }}.
+{{ _("This could have a couple of reasons and needs to be investigated by you.") }}
+
+{{ _("Here is more information about the incident:") }}
+
+* {{ _("Name") }}: {{ job.name }}
+{% if job.builder %}* {{ _("Builder") }}: {{ job.builder }}{% end %}
+
+{{ _("Click on this link to get all details about the build:") }}
+ {{ baseurl }}/job/{{ job.uuid }}
+
+{{ _("Sincerely,") }}
+-{{ _("The Pakfire Build Service") }}
\ No newline at end of file
--- /dev/null
+Subject: [{{ job.name }}] {{ _("Build job finished") }}
+
+{{ _("The build job %s has finished") % job.name }}.
+
+{{ _("If you are the maintainer, it is up to you to push it to one or more repositories.") }}
+
+{{ _("Click on this link to get all details about the build:") }}
+ {{ baseurl }}/job/{{ job.uuid }}
+
+{{ _("Sincerely,") }}
+-{{ _("The Pakfire Build Service") }}
\ No newline at end of file