aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarChristoph Goehre <christoph.goehre@gmx.de>2008-11-17 17:39:52 +0100
committerLibravatarChristoph Goehre <christoph.goehre@gmx.de>2008-11-17 17:39:52 +0100
commit59d3992284331ed72fb4df015dcb466004cb3a4f (patch)
treeb99b4d41eee5c501192ef6548a42ec52b2a48b75
parent828c0b56d0bf37fa238008491eb8be2e46f40992 (diff)
check mail_template strings for existence
If You create changes files with 'changestool' from the debian package reprepro, it result in changes files without 'Changes' and 'Changed-By' fields. So mini-dinstall will crash if sending succes upload emails. But in the other hand, its better to check 'by user' configurable vars anyway.
-rwxr-xr-xmini-dinstall21
1 files changed, 18 insertions, 3 deletions
diff --git a/mini-dinstall b/mini-dinstall
index fa21961..91fb4e9 100755
--- a/mini-dinstall
+++ b/mini-dinstall
@@ -796,9 +796,24 @@ class ArchiveDir:
do_rename(changefilename, target)
self._logger.info('Successfully installed %s %s to %s' % (sourcename, version, self._name))
if self._mail_on_success:
- changefile ['changes_without_dot'] = misc.format_changes(changefile['changes'])
- self.mailHandler.setSubject(mail_subject_template % changefile)
- self._success_logger.info(mail_body_template % changefile)
+ done = False
+ missing_fields = []
+ if changefile.has_key('changes'):
+ changefile ['changes_without_dot'] = misc.format_changes(changefile['changes'])
+ while not done:
+ try:
+ mail_subject = mail_subject_template % changefile
+ mail_body = mail_body_template % changefile
+ except KeyError, exc:
+ key = exc.args[0]
+ changefile[key] = ''
+ missing_fields.append(key)
+ else:
+ done = True
+ if missing_fields:
+ mail_body = mail_body + "\n\nMissing changefile fields: %s" % missing_fields
+ self.mailHandler.setSubject(mail_subject)
+ self._success_logger.info(mail_body)
if self._post_install_script:
try: