From bedb27cb29c9887b4340fdaff5a3975757a5da11 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Fri, 2 Feb 2007 20:22:43 +0000 Subject: Clean up tool driver conflict code git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2769 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Frame.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/lib/Client/Frame.py') diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py index 879ab0be2..b51b5d7ca 100644 --- a/src/lib/Client/Frame.py +++ b/src/lib/Client/Frame.py @@ -50,27 +50,27 @@ class Frame: tools = self.setup['drivers'].split(',') else: tools = Bcfg2.Client.Tools.__all__[:] - tmods = {} + tclass = {} for tool in tools: tool_class = "Bcfg2.Client.Tools.%s" % tool try: - tmods[tool] = __import__(tool_class, globals(), locals(), ['*']) + tclass[tool] = getattr(__import__(tool_class, globals(), locals(), ['*']), + tool) except ImportError: continue - for (tool, mod) in tmods.iteritems(): + for tool in tclass.values(): + for conflict in getattr(tool, 'conflicts', []): + tclass.pop(conflict) + + for tool in tclass.values(): try: - self.tools.append(getattr(mod, tool)(self.logger, setup, config, self.states)) + self.tools.append(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) - for tool in self.tools[:]: - for conflict in getattr(tool, 'conflicts', []): - [self.tools.remove(item) for item in self.tools \ - if item.__name__ == conflict] - self.logger.info("Loaded tool drivers:") self.logger.info([tool.__name__ for tool in self.tools]) if not self.setup['dryrun']: -- cgit v1.2.3-1-g7c22