-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Subject: unattended-upgrades: please include hostname in emails
Package: unattended-upgrades
Version: 0.25.1debian1-0.1
Severity: wishlist
Tags: patch

Please include the hostname in the email messages that are sent out. When using this on multiple machines currently you have to look at the received headers to find out on which host the upgrade ran.

The attached patch adds the hostname to the subject.

- -- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_GB (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages unattended-upgrades depends on:
ii  apt                           0.7.14+b1  Advanced front-end for dpkg
ii  apt-utils                     0.7.14+b1  APT utility programs
ii  python                        2.5.2-2    An interactive high-level object-o
ii  python-apt                    0.7.7.1    Python interface to libapt-pkg

- -- - -- arthur - [EMAIL PROTECTED] - http://people.debian.org/~adejong --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFI9FN6VYan35+NCKcRAr1cAKC4lmGwpvUhHY/vYOZwyAFVnwoY0ACfUxOS
QX7RtapgpYZYz80vftYGfmY=
=fXBA
-----END PGP SIGNATURE-----
diff -Nauwir unattended-upgrades-0.25.1debian1.orig/unattended-upgrade unattended-upgrades-0.25.1debian1/unattended-upgrade
--- unattended-upgrades-0.25.1debian1.orig/unattended-upgrade	2007-04-24 23:32:11.000000000 +0200
+++ unattended-upgrades-0.25.1debian1/unattended-upgrade	2008-10-13 11:03:22.000000000 +0200
@@ -256,9 +256,11 @@
     # check if we need to send a mail
     email = apt_pkg.Config.Find("Unattended-Upgrade::Mail", "")
     if email != "":
+        import socket
         logging.debug("Sending mail with '%s' to '%s'" % (logfile_dpkg, email))
-        mail = subprocess.Popen(["mail",
-                                 "-s","unattended-upgrades result",email],
+        mail = subprocess.Popen(["mail", "-s",
+                                 "unattended-upgrades results for %s" % socket.gethostname(),
+                                 email],
                                 stdin=subprocess.PIPE)
         s = "Unattended upgrade returned: %s\n\n" % (res != pm.ResultFailed)
         s += open(logfile_dpkg).read()

Reply via email to