summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2014-11-16 16:23:01 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2014-11-16 17:37:46 +0100
commitee4111fcc7fa66c61bc20a3f7901d0e1736e1ef6 (patch)
treee58ecd8c2b1bded03c6288c3c2bf457ff4de36db
parent53ec8afee9c963de5883b9b7ca9bd6537deef123 (diff)
downloadbcfg2-ee4111fcc7fa66c61bc20a3f7901d0e1736e1ef6.tar.gz
bcfg2-ee4111fcc7fa66c61bc20a3f7901d0e1736e1ef6.tar.bz2
bcfg2-ee4111fcc7fa66c61bc20a3f7901d0e1736e1ef6.zip
Client/Tools/APT: remove all the stuff for the old API
-rw-r--r--debian/control2
-rw-r--r--doc/installation/prerequisites.txt2
-rw-r--r--src/lib/Bcfg2/Client/Tools/APT.py71
3 files changed, 19 insertions, 56 deletions
diff --git a/debian/control b/debian/control
index 8eb4343c7..452fa3d5f 100644
--- a/debian/control
+++ b/debian/control
@@ -24,7 +24,7 @@ Homepage: http://bcfg2.org/
Package: bcfg2
Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}, debsums, python-apt, ucf, lsb-base (>= 3.1-9), python (>= 2.6)
+Depends: ${python:Depends}, ${misc:Depends}, debsums, python-apt (>= 0.7.91), ucf, lsb-base (>= 3.1-9), python (>= 2.6)
Description: Configuration management client
Bcfg2 is a configuration management system that generates configuration sets
for clients bound by client profiles.
diff --git a/doc/installation/prerequisites.txt b/doc/installation/prerequisites.txt
index 8119be06b..d89d44894 100644
--- a/doc/installation/prerequisites.txt
+++ b/doc/installation/prerequisites.txt
@@ -25,7 +25,7 @@ Bcfg2 Client
+----------------------------+------------------------+--------------------------------+
| lxml or elementtree [#f2]_ | Any | lxml: libxml2, libxslt, python |
+----------------------------+------------------------+--------------------------------+
-| python-apt [#f3]_ | Any | python |
+| python-apt [#f3]_ | 0.7.91 and greater | python |
+----------------------------+------------------------+--------------------------------+
| debsums (if APT tool | Any | |
| driver is used) | | |
diff --git a/src/lib/Bcfg2/Client/Tools/APT.py b/src/lib/Bcfg2/Client/Tools/APT.py
index 9fcb7a3e0..fe615b39c 100644
--- a/src/lib/Bcfg2/Client/Tools/APT.py
+++ b/src/lib/Bcfg2/Client/Tools/APT.py
@@ -89,20 +89,12 @@ class APT(Bcfg2.Client.Tools.Tool):
err = sys.exc_info()[1]
self.logger.info("Failed to update APT cache: %s" % err)
self.pkg_cache = apt.cache.Cache()
- if 'req_reinstall_pkgs' in dir(self.pkg_cache):
- self._newapi = True
- else:
- self._newapi = False
def FindExtra(self):
"""Find extra packages."""
packages = [entry.get('name') for entry in self.getSupportedEntries()]
- if self._newapi:
- extras = [(p.name, p.installed.version) for p in self.pkg_cache
- if p.is_installed and p.name not in packages]
- else:
- extras = [(p.name, p.installedVersion) for p in self.pkg_cache
- if p.isInstalled and p.name not in packages]
+ extras = [(p.name, p.installed.version) for p in self.pkg_cache
+ if p.is_installed and p.name not in packages]
return [Bcfg2.Client.XML.Element('Package', name=name,
type='deb', version=version)
for (name, version) in extras]
@@ -168,30 +160,18 @@ class APT(Bcfg2.Client.Tools.Tool):
return False
pkgname = entry.get('name')
if self.pkg_cache.has_key(pkgname): # noqa
- if self._newapi:
- is_installed = self.pkg_cache[pkgname].is_installed
- else:
- is_installed = self.pkg_cache[pkgname].isInstalled
+ is_installed = self.pkg_cache[pkgname].is_installed
if not self.pkg_cache.has_key(pkgname) or not is_installed: # noqa
self.logger.info("Package %s not installed" % (entry.get('name')))
entry.set('current_exists', 'false')
return False
pkg = self.pkg_cache[pkgname]
- if self._newapi:
- installed_version = pkg.installed.version
- candidate_version = pkg.candidate.version
- else:
- installed_version = pkg.installedVersion
- candidate_version = pkg.candidateVersion
+ installed_version = pkg.installed.version
+ candidate_version = pkg.candidate.version
if entry.get('version') == 'auto':
# pylint: disable=W0212
- if self._newapi:
- is_upgradable = self.pkg_cache._depcache.is_upgradable(
- pkg._pkg)
- else:
- is_upgradable = self.pkg_cache._depcache.IsUpgradable(
- pkg._pkg)
+ is_upgradable = self.pkg_cache._depcache.is_upgradable(pkg._pkg)
# pylint: enable=W0212
if is_upgradable:
desired_version = candidate_version
@@ -225,15 +205,9 @@ class APT(Bcfg2.Client.Tools.Tool):
self.logger.info(pkgnames)
for pkg in pkgnames.split(" "):
try:
- if self._newapi:
- self.pkg_cache[pkg].mark_delete(purge=True)
- else:
- self.pkg_cache[pkg].markDelete(purge=True)
+ self.pkg_cache[pkg].mark_delete(purge=True)
except: # pylint: disable=W0702
- if self._newapi:
- self.pkg_cache[pkg].mark_delete()
- else:
- self.pkg_cache[pkg].markDelete()
+ self.pkg_cache[pkg].mark_delete()
try:
self.pkg_cache.commit()
except SystemExit:
@@ -254,29 +228,18 @@ class APT(Bcfg2.Client.Tools.Tool):
% (pkg.get('name')))
continue
if pkg.get('version') in ['auto', 'any']:
- if self._newapi:
- try:
- ipkgs.append("%s=%s" % (
- pkg.get('name'),
- self.pkg_cache[pkg.get('name')].candidate.version))
- except AttributeError:
- self.logger.error("Failed to find %s in apt package "
- "cache" % pkg.get('name'))
- continue
- else:
+ try:
ipkgs.append("%s=%s" % (
pkg.get('name'),
- self.pkg_cache[pkg.get('name')].candidateVersion))
- continue
+ self.pkg_cache[pkg.get('name')].candidate.version))
+ except AttributeError:
+ self.logger.error("Failed to find %s in apt package "
+ "cache" % pkg.get('name'))
+ continue
# pylint: disable=W0212
- if self._newapi:
- avail_vers = [
- x.ver_str for x in
- self.pkg_cache[pkg.get('name')]._pkg.version_list]
- else:
- avail_vers = [
- x.VerStr for x in
- self.pkg_cache[pkg.get('name')]._pkg.VersionList]
+ avail_vers = [
+ x.ver_str for x in
+ self.pkg_cache[pkg.get('name')]._pkg.version_list]
# pylint: enable=W0212
if pkg.get('version') in avail_vers:
ipkgs.append("%s=%s" % (pkg.get('name'), pkg.get('version')))