summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-01-11 16:31:59 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-01-11 16:31:59 +0000
commita3c565340fde4e811a6a7c8af0d71244c80cfed0 (patch)
treeffe9deed6a1895586605fe0b20efbf8eb0893c2f /src/lib
parent4a02429e891163947d8d34934726376fd160440e (diff)
downloadbcfg2-a3c565340fde4e811a6a7c8af0d71244c80cfed0.tar.gz
bcfg2-a3c565340fde4e811a6a7c8af0d71244c80cfed0.tar.bz2
bcfg2-a3c565340fde4e811a6a7c8af0d71244c80cfed0.zip
Add conflicts support for tool drivers
* Add Yum conflict with RPM * Add Yum dependency on /var/lib/rpm git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2645 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Client/Frame.py11
-rw-r--r--src/lib/Client/Tools/Yum.py6
2 files changed, 13 insertions, 4 deletions
diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py
index e1ff3b669..6147e15a6 100644
--- a/src/lib/Client/Frame.py
+++ b/src/lib/Client/Frame.py
@@ -42,19 +42,26 @@ class Frame:
tools = self.setup['drivers'].split(',')
else:
tools = Bcfg2.Client.Tools.__all__[:]
+ tmods = {}
+ tool_class = "Bcfg2.Client.Tools.%s" % tool
for tool in tools:
try:
- tool_class = "Bcfg2.Client.Tools.%s" % tool
- mod = __import__(tool_class, globals(), locals(), ['*'])
+ tmods[tool] = __import__(tool_class, globals(), locals(), ['*'])
except ImportError:
continue
+ for tool in tools:
+ for conflict in getattr(tool, 'conflicts', []):
+ del tmods[conflict]
+
+ for (tool, mod) in tmods.iteritems():
try:
self.tools.append(getattr(mod, tool)(self.logger, setup, config, self.states))
except Bcfg2.Client.Tools.toolInstantiationError:
continue
except:
self.logger.error("Failed to instantiate tool %s" % (tool), exc_info=1)
+
self.logger.info("Loaded tool drivers:")
self.logger.info([tool.__name__ for tool in self.tools])
if not self.setup['dryrun']:
diff --git a/src/lib/Client/Tools/Yum.py b/src/lib/Client/Tools/Yum.py
index 62ccbffc4..641d30a30 100644
--- a/src/lib/Client/Tools/Yum.py
+++ b/src/lib/Client/Tools/Yum.py
@@ -1,15 +1,17 @@
# This is the bcfg2 support for yum
'''This provides bcfg2 support for yum'''
-__revision__ = '$Revision:$'
+__revision__ = '$Revision$'
import Bcfg2.Client.Tools.RPM
+conflicts = ['RPM']
+
class Yum(Bcfg2.Client.Tools.RPM.RPM):
'''Support for Yum packages'''
pkgtype = 'yum'
pkgtool = ("/usr/bin/yum install %s", ("%s-%s", ["name", "version"]))
__name__ = 'Yum'
- __execs__ = ['/usr/bin/yum']
+ __execs__ = ['/usr/bin/yum', '/var/lib/rpm']
__handles__ = [('Package', 'yum')]
def RemovePackages(self, packages):