From f54fd46a0dd6734be0fa4c1ac5de7a3af41a21a9 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 23 Sep 2016 11:53:23 +0200 Subject: whatmaps/debiandistro.py: flake8 clean --- whatmaps/debiandistro.py | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'whatmaps/debiandistro.py') diff --git a/whatmaps/debiandistro.py b/whatmaps/debiandistro.py index 1a1dbd4..bb3f5cb 100644 --- a/whatmaps/debiandistro.py +++ b/whatmaps/debiandistro.py @@ -36,26 +36,28 @@ from . debianpkg import DebianPkg from . pkg import PkgError from . systemd import Systemd + class DebianDistro(Distro): "Debian (dpkg) based distribution" id = 'Debian' - _pkg_services = { 'apache2-mpm-worker': [ 'apache2' ], - 'apache2-mpm-prefork': [ 'apache2' ], - 'apache2.2-bin': [ 'apache2' ], - 'apache2-bin': [ 'apache2' ], - 'dovecot-imapd': [ 'dovecot' ], - 'dovecot-pop3d': [ 'dovecot' ], - 'exim4-daemon-light': [ 'exim4' ], - 'exim4-daemon-heavy': [ 'exim4' ], - 'libvirt-daemon': [ 'libvirtd' ], - 'openjdk-6-jre-headless': ['jenkins', 'tomcat7'], - 'openjdk-7-jre-headless': ['jenkins', 'tomcat7'], - 'qemu-system-x86_64': [ 'libvirt-guests' ], - } + _pkg_services = { + 'apache2-mpm-worker': ['apache2'], + 'apache2-mpm-prefork': ['apache2'], + 'apache2.2-bin': ['apache2'], + 'apache2-bin': ['apache2'], + 'dovecot-imapd': ['dovecot'], + 'dovecot-pop3d': ['dovecot'], + 'exim4-daemon-light': ['exim4'], + 'exim4-daemon-heavy': ['exim4'], + 'libvirt-daemon': ['libvirtd'], + 'openjdk-6-jre-headless': ['jenkins', 'tomcat7'], + 'openjdk-7-jre-headless': ['jenkins', 'tomcat7'], + 'qemu-system-x86_64': ['libvirt-guests'], + } # Per package blacklist - _pkg_service_blacklist = { 'libvirt-bin': [ 'libvirt-guests' ] } + _pkg_service_blacklist = {'libvirt-bin': ['libvirt-guests']} # Per distro blacklist service_blacklist = set(['kvm', 'qemu-kvm', 'qemu-system-x86']) @@ -67,8 +69,8 @@ class DebianDistro(Distro): @classmethod def pkg_by_file(klass, path): find_file = subprocess.Popen(['dpkg-query', '-S', path], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) output = find_file.communicate()[0] if find_file.returncode: return None @@ -124,12 +126,11 @@ class DebianDistro(Distro): (pkgname, oldversion, compare, newversion, filename) = line.split() if filename == '**CONFIGURE**': - if oldversion != '-': # Updates only + if oldversion != '-': # Updates only pkgs[pkgname] = DebianPkg(pkgname) pkgs[pkgname].version = newversion return pkgs - @classmethod def _security_update_origins(klass): "Determine security update origins from apt configuration" @@ -138,9 +139,10 @@ class DebianDistro(Distro): raise PkgError("lsb_release not found, can't determine security updates") codename = lsb_release.get_distro_information()['CODENAME'] + def _subst(line): - mapping = {'distro_codename' : codename, - 'distro_id' : klass.id, } + mapping = {'distro_codename': codename, + 'distro_id': klass.id, } return string.Template(line).substitute(mapping) origins = [] @@ -151,7 +153,6 @@ class DebianDistro(Distro): logging.debug("Security Update Origins: %s", origins) return origins - @classmethod def filter_security_updates(klass, pkgs): """Filter on security updates""" @@ -160,7 +161,7 @@ class DebianDistro(Distro): raise PkgError("apt_pkg not installed, can't determine security updates") apt_pkg.init() - acquire = apt_pkg.Acquire() + apt_pkg.Acquire() cache = apt_pkg.Cache() security_update_origins = klass._security_update_origins() -- cgit v1.2.3