summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-10-09 18:37:01 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-10-09 18:37:01 +0000
commit1e1c2914705d1acf8ab674012f81814cc112e57c (patch)
tree99f99dab1f779dc4be5d9773a3836785cb4387cb /src
parent73c435c6d512500d0ad8d21aab41de9180d25c2f (diff)
downloadbcfg2-1e1c2914705d1acf8ab674012f81814cc112e57c.tar.gz
bcfg2-1e1c2914705d1acf8ab674012f81814cc112e57c.tar.bz2
bcfg2-1e1c2914705d1acf8ab674012f81814cc112e57c.zip
* APT now fails cleanly on non-apt platforms
* PkgTool now calls RefreshPackages properly on instantiation * RPM handles error case with bogus output more robustly (should maybe move to the rpm python bindings?) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2412 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Client/Tools/APT.py7
-rw-r--r--src/lib/Client/Tools/RPM.py2
-rw-r--r--src/lib/Client/Tools/__init__.py1
3 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/Client/Tools/APT.py b/src/lib/Client/Tools/APT.py
index f78cd9cbd..b6b09d1b3 100644
--- a/src/lib/Client/Tools/APT.py
+++ b/src/lib/Client/Tools/APT.py
@@ -1,9 +1,14 @@
'''This is the bcfg2 support for apt-get'''
__revision__ = '$Revision$'
-import apt_pkg, os, re
+import os, re
import Bcfg2.Client.Tools
+try:
+ import apt_pkg
+except ImportError:
+ raise toolInstantiationError
+
class APT(Bcfg2.Client.Tools.PkgTool):
'''The Debian toolset implements package and service operations and inherits
the rest from Toolset.Toolset'''
diff --git a/src/lib/Client/Tools/RPM.py b/src/lib/Client/Tools/RPM.py
index 661c0a167..3a3d1b7e4 100644
--- a/src/lib/Client/Tools/RPM.py
+++ b/src/lib/Client/Tools/RPM.py
@@ -23,6 +23,8 @@ class RPM(Bcfg2.Client.Tools.PkgTool):
(name, version) = line.split()
self.installed[name] = version
except ValueError:
+ if line == '':
+ continue
self.logger.error("Failed to access RPM db; retrying after 30s")
time.sleep(30)
return self.RefreshPackages(level + 1)
diff --git a/src/lib/Client/Tools/__init__.py b/src/lib/Client/Tools/__init__.py
index da9f47eeb..c415493ab 100644
--- a/src/lib/Client/Tools/__init__.py
+++ b/src/lib/Client/Tools/__init__.py
@@ -171,6 +171,7 @@ class PkgTool(Tool):
self.installed = {}
self.Remove = self.RemovePackages
self.FindExtra = self.FindExtraPackages
+ self.RefreshPackages()
def VerifyPackage(self, dummy, _):
'''Dummy verification method'''