From 48c912b193cb9be1f804b95f30711dfac5bed4e9 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 11 Jul 2014 20:53:31 +0200 Subject: Another import bugfix --- whatmaps/debiandistro.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/whatmaps/debiandistro.py b/whatmaps/debiandistro.py index 9294c9f..3a3bf16 100644 --- a/whatmaps/debiandistro.py +++ b/whatmaps/debiandistro.py @@ -31,12 +31,12 @@ import subprocess import sys import string -import whatmaps.distro +from . distro import Distro from . debianpkg import DebianPkg from . pkg import PkgError from . systemd import Systemd -class DebianDistro(whatmaps.distro.Distro): +class DebianDistro(Distro): "Debian (dpkg) based distribution" id = 'Debian' -- cgit v1.2.3 From 1a501af16db1f1122b7709b83c41cb4c1115f661 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Mon, 14 Jul 2014 16:12:43 +0200 Subject: Abort early if we found a match Once we found a shared object that a process maps we don't need to continue with the other shared objects since one is enough to require a process restart. --- whatmaps/command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whatmaps/command.py b/whatmaps/command.py index 7690ef8..e649cbb 100755 --- a/whatmaps/command.py +++ b/whatmaps/command.py @@ -39,7 +39,7 @@ def check_maps(procs, shared_objects): restart_procs[proc.exe] += [ proc ] else: restart_procs[proc.exe] = [ proc ] - continue + break return restart_procs -- cgit v1.2.3 From 617fed459bf9c6c05d5cecc126cc7a83b432ac66 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Thu, 25 Sep 2014 08:24:01 +0200 Subject: Add sv Debconf translation Thanks: Martin Bagge Closes: #761973 --- debian/po/sv.po | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 debian/po/sv.po diff --git a/debian/po/sv.po b/debian/po/sv.po new file mode 100644 index 0000000..2ee931e --- /dev/null +++ b/debian/po/sv.po @@ -0,0 +1,50 @@ +# Translation of whatmaps debconf template to Swedish +# Copyright (C) 2014 Martin Bagge +# This file is distributed under the same license as the XX package. +# +# Martin Bagge , 2014 +msgid "" +msgstr "" +"Project-Id-Version: whatmaps\n" +"Report-Msgid-Bugs-To: whatmaps@packages.debian.org\n" +"POT-Creation-Date: 2014-08-20 06:56+0200\n" +"PO-Revision-Date: 2014-09-17 13:22+0100\n" +"Last-Translator: Martin Bagge / brother \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.4\n" +"Language: Swedish\n" + +#. Type: boolean +#. Description +#: ../templates:2001 +msgid "Automatically restart services after library security updates?" +msgstr "" +"Ska tjänster startas om automatiskt efter säkerhetsuppdateringar för " +"bibliotek?" + +#. Type: boolean +#. Description +#: ../templates:2001 +msgid "" +"Services need to be restarted to benefit from updates of shared libraries " +"they depend on. Otherwise they remain vulnerable to security bugs fixed in " +"these updates." +msgstr "" +"Tjänster behöver startas om för att dra nytta av uppdateringar av delade " +"bibliotek som de är beroende av. Annars kan tjänsterna fortsätta vara " +"sårbara för säkerhetsfel som lösts i dessa uppdateringar." + +#. Type: boolean +#. Description +#: ../templates:2001 +msgid "" +"Automatic service restarts are only done if APT fetched the library from a " +"source providing security updates. This also affects packages installed via " +"\"unattended-upgrades\"." +msgstr "" +"Automatiska omstarter av tjänster görs bara om APT hämtar biblioteket från " +"en källa som tillhandahåller säkerhetsuppdateringar. Detta påverkar också " +"paket installerade voa \"unattended-upgrades\"." -- cgit v1.2.3 From 1a7a8b96df9b784bbe00e6457c2ff9c87d307102 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sat, 27 Sep 2014 13:42:28 +0200 Subject: Fix smoketest The name of the libvirt service changed --- debian/tests/smoke | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/tests/smoke b/debian/tests/smoke index dde8c37..f4a8642 100755 --- a/debian/tests/smoke +++ b/debian/tests/smoke @@ -1,3 +1,3 @@ #!/bin/sh -whatmaps libvirt0 | grep -qs ^libvirt-bin +whatmaps libvirt0 | grep -qsE '^(libvirt-bin|libvirtd)' -- cgit v1.2.3 From 472cbbd1493cf4a23e9a6ffcdbfac44584ea25ee Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sat, 27 Sep 2014 13:42:57 +0200 Subject: Document changes and release 0.0.8-5 --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index ac9909c..9238046 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +whatmaps (0.0.8-5) unstable; urgency=medium + + * [617fed4] Add sv Debconf translation. Thanks to Martin Bagge (Closes: + #761973) + * [1a7a8b9] Fix smoketest. The name of the libvirt service changed + + -- Guido Günther Sat, 27 Sep 2014 13:42:48 +0200 + whatmaps (0.0.8-4) unstable; urgency=medium * [47c0bfa] Don't create backup copies of 20services -- cgit v1.2.3 From 36fd4eee614a35fece4ccc085af73d92ce5de2a4 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 17 Oct 2014 09:31:06 +0200 Subject: Avoid error message on missing file Don't try to get the md5sum of a nonexistent file to avoid md5sum: /etc/apt/apt.conf.d/20servicese: No such file or directory which is confusing. --- debian/preinst | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/debian/preinst b/debian/preinst index 1d54ef0..1ea0c9f 100644 --- a/debian/preinst +++ b/debian/preinst @@ -17,12 +17,14 @@ set -e case "$1" in install|upgrade) if dpkg --compare-versions "$2" lt-nl "0.0.8-3~"; then - # Remove backup copies of services file - md5=$(md5sum /etc/apt/apt.conf.d/20servicese | sed -e 's/ .*//') - case "$md5" in - 074e684668c83b8a98c5eeb8257c88f2|509ad2c35aa4da3153dd6e70941e060b) - rm -f /etc/apt/apt.conf.d/20servicese - esac + if [ -f /etc/apt/apt.conf.d/20servicese ]; then + # Remove errnoneous backup copies of services file + md5=$(md5sum /etc/apt/apt.conf.d/20servicese | sed -e 's/ .*//') + case "$md5" in + 074e684668c83b8a98c5eeb8257c88f2|509ad2c35aa4da3153dd6e70941e060b) + rm -f /etc/apt/apt.conf.d/20servicese + esac + fi fi ;; -- cgit v1.2.3 From 506e87c479fb181b800c4bfdb8ca018f1a1bb6c1 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sun, 28 Dec 2014 14:32:52 +0100 Subject: Report PIDs of deleted executables at debug level It's not of any interest to the user. --- whatmaps/process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whatmaps/process.py b/whatmaps/process.py index 1abde23..23ed7ab 100644 --- a/whatmaps/process.py +++ b/whatmaps/process.py @@ -36,7 +36,7 @@ class Process(object): if m: self.exe = m.group('exe') self.deleted = True - logging.info("Using deleted exe %s", self.exe) + logging.debug("Using deleted exe %s", self.exe) if not os.path.exists(self.exe): logging.debug("%s doesn't exist", self.exe) self.cmdline = open(self._procpath('%d/cmdline' % self.pid)).read() -- cgit v1.2.3 From 8c5b2930b37f7cf6fd0a44e4283bf2c79fbc13bd Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sun, 28 Dec 2014 14:37:00 +0100 Subject: Log services to restart in apt pipeline too All other code paths log this at debug level. We should to so too to get improved output when using unattended-upgrades. --- whatmaps/command.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/whatmaps/command.py b/whatmaps/command.py index e649cbb..0a4eb7b 100755 --- a/whatmaps/command.py +++ b/whatmaps/command.py @@ -59,7 +59,7 @@ def write_cmd_file(services, cmd_file, distro): out = open(cmd_file, 'w') print('#! /bin/sh', file=out) for service in services: - logging.debug("Need to restart %s", service) + logging.info("Need to restart '%s'", service) print(" ".join(distro.restart_service_cmd(service)), file=out) out.close() os.chmod(cmd_file, 0o755) @@ -225,7 +225,7 @@ def main(argv): write_cmd_file(services, options.print_cmds, distro) else: for service in services: - logging.info("Restarting %s" % service) + logging.info("Restarting '%s'" % service) distro.restart_service(service) elif services: print("Services that possibly need to be restarted:") -- cgit v1.2.3 From 9b32d5e86ef7ad4b4e802ec8fb16b21fb47d45b8 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sun, 28 Dec 2014 14:49:03 +0100 Subject: Fix service name parsing for systemd >= 215 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Newer systemd put a colored bullet point '●' in front of the service name output: # sudo systemctl status 971 ● libvirtd.service - Virtualization daemon ... Skip that. --- whatmaps/command.py | 7 ++++++- whatmaps/systemd.py | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/whatmaps/command.py b/whatmaps/command.py index 0a4eb7b..d0f5c3e 100755 --- a/whatmaps/command.py +++ b/whatmaps/command.py @@ -113,7 +113,12 @@ def find_systemd_units(procmap, distro): for dummy, procs in procmap.items(): for proc in procs: - unit = Systemd.process_to_unit(proc) + try: + unit = Systemd.process_to_unit(proc) + except ValueError as e: + logging.warning("No systemd unit found for '%s': %s" + "- restart manually" % (proc.exe, e)) + continue if not unit: logging.warning("No systemd unit found for '%s'" "- restart manually" % proc.exe) diff --git a/whatmaps/systemd.py b/whatmaps/systemd.py index add6d0e..3407128 100644 --- a/whatmaps/systemd.py +++ b/whatmaps/systemd.py @@ -38,4 +38,10 @@ class Systemd(object): if systemctl_status.returncode: return None else: - return output.split()[0] + parts = output.split() + if parts[0].endswith('.service'): + return parts[0] + elif parts[1].endswith('.service'): + return parts[1] + else: + raise ValueError("Can't parse service name from\n%s" % output) -- cgit v1.2.3 From 1ee865fefdd5267c2ada84cc370f2005b6b1a5b6 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sun, 28 Dec 2014 15:01:39 +0100 Subject: Install apt.conf configuration on derivatives too Closes: #761054 --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7e7ed00..cdadd50 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,8 @@ data_files = [] try: import lsb_release - if lsb_release.get_distro_information()['ID'] in [ 'Debian' ]: + if (lsb_release.get_distro_information()['ID'] in [ 'Debian' ] or + os.path.exists('/etc/debian_version')): data_files = [('../etc/apt/apt.conf.d/', ['apt/50whatmaps_apt']), ('../etc/apt/apt.conf.d/', -- cgit v1.2.3 From d0bdc62cddff86b8601bb0e32b8a115be65032ff Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sun, 28 Dec 2014 15:05:26 +0100 Subject: Document changes and release 0.0.9-1 --- debian/changelog | 14 +++++++++++ debian/patches/0001-Another-import-bugfix.patch | 27 ---------------------- .../0002-Abort-early-if-we-found-a-match.patch | 24 ------------------- debian/patches/series | 2 -- 4 files changed, 14 insertions(+), 53 deletions(-) delete mode 100644 debian/patches/0001-Another-import-bugfix.patch delete mode 100644 debian/patches/0002-Abort-early-if-we-found-a-match.patch delete mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index 9238046..94fec4b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,17 @@ +whatmaps (0.0.9-1) unstable; urgency=medium + + * New upstream version: + * Install apt.conf configuration on derivatives too (Closes: #761054) + * Fix service detection with newer systemd (as in Debian Jessie) + * Make logging consistent + * [36fd4ee] Avoid error message on missing file. + Don't try to get the md5sum of a nonexistent file to avoid + md5sum: /etc/apt/apt.conf.d/20servicese: No such file or directory + which is confusing. + * Drop all patches merged upstream + + -- Guido Günther Sun, 28 Dec 2014 15:04:26 +0100 + whatmaps (0.0.8-5) unstable; urgency=medium * [617fed4] Add sv Debconf translation. Thanks to Martin Bagge (Closes: diff --git a/debian/patches/0001-Another-import-bugfix.patch b/debian/patches/0001-Another-import-bugfix.patch deleted file mode 100644 index 9cbb73e..0000000 --- a/debian/patches/0001-Another-import-bugfix.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: =?utf-8?q?Guido_G=C3=BCnther?= -Date: Fri, 11 Jul 2014 20:53:31 +0200 -Subject: Another import bugfix - ---- - whatmaps/debiandistro.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/whatmaps/debiandistro.py b/whatmaps/debiandistro.py -index 9294c9f..3a3bf16 100644 ---- a/whatmaps/debiandistro.py -+++ b/whatmaps/debiandistro.py -@@ -31,12 +31,12 @@ import subprocess - import sys - import string - --import whatmaps.distro -+from . distro import Distro - from . debianpkg import DebianPkg - from . pkg import PkgError - from . systemd import Systemd - --class DebianDistro(whatmaps.distro.Distro): -+class DebianDistro(Distro): - "Debian (dpkg) based distribution" - id = 'Debian' - diff --git a/debian/patches/0002-Abort-early-if-we-found-a-match.patch b/debian/patches/0002-Abort-early-if-we-found-a-match.patch deleted file mode 100644 index 3513ad6..0000000 --- a/debian/patches/0002-Abort-early-if-we-found-a-match.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: =?utf-8?q?Guido_G=C3=BCnther?= -Date: Mon, 14 Jul 2014 16:12:43 +0200 -Subject: Abort early if we found a match - -Once we found a shared object that a process maps we don't need to -continue with the other shared objects since one is enough to require -a process restart. ---- - whatmaps/command.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/whatmaps/command.py b/whatmaps/command.py -index 7690ef8..e649cbb 100755 ---- a/whatmaps/command.py -+++ b/whatmaps/command.py -@@ -39,7 +39,7 @@ def check_maps(procs, shared_objects): - restart_procs[proc.exe] += [ proc ] - else: - restart_procs[proc.exe] = [ proc ] -- continue -+ break - return restart_procs - - diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index 219effd..0000000 --- a/debian/patches/series +++ /dev/null @@ -1,2 +0,0 @@ -0001-Another-import-bugfix.patch -0002-Abort-early-if-we-found-a-match.patch -- cgit v1.2.3