From 41d66f5eba22ba37bcb798cd5f110be868de0e10 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sun, 16 Nov 2014 16:41:53 +0100 Subject: Client/Tools/APT: use "pkg in cache" everywhere The "in syntax" is supported instead of the cache.has_key(pkg) syntax at least since python-apt-0.7.91. --- src/lib/Bcfg2/Client/Tools/APT.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Bcfg2/Client/Tools/APT.py b/src/lib/Bcfg2/Client/Tools/APT.py index 19e506105..bafe4e528 100644 --- a/src/lib/Bcfg2/Client/Tools/APT.py +++ b/src/lib/Bcfg2/Client/Tools/APT.py @@ -159,9 +159,9 @@ class APT(Bcfg2.Client.Tools.Tool): (entry.attrib['name'])) return False pkgname = entry.get('name') - if self.pkg_cache.has_key(pkgname): # noqa + if pkgname in self.pkg_cache: is_installed = self.pkg_cache[pkgname].is_installed - if not self.pkg_cache.has_key(pkgname) or not is_installed: # noqa + if pkgname not in self.pkg_cache or not is_installed: self.logger.info("Package %s not installed" % (entry.get('name'))) entry.set('current_exists', 'false') return False @@ -216,7 +216,7 @@ class APT(Bcfg2.Client.Tools.Tool): ipkgs = [] bad_pkgs = [] for pkg in packages: - if not self.pkg_cache.has_key(pkg.get('name')): # noqa + if pkg.get('name') not in self.pkg_cache: self.logger.error("APT has no information about package %s" % (pkg.get('name'))) continue -- cgit v1.2.3-1-g7c22