From 0adf63e1c4581d8c0d8f9979696e9e605c9f8d28 Mon Sep 17 00:00:00 2001 From: Brian Pellin Date: Thu, 6 Jan 2005 20:50:12 +0000 Subject: Added runtime toolset selection. (Logical change 1.174) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@759 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2 | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index e630a5f29..9264e91c4 100644 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -12,7 +12,21 @@ from elementtree.ElementTree import Element, XML, tostring from sss.ssslib import comm_lib -from Bcfg2.Client.Debian import Debian +def loadToolset(toolset, config, setup): + if toolset == 'debian': + if setup['verbose']: + print 'Selected Debian Toolset...' + mod = __import__("Bcfg2.Client.Debian",globals(), locals(), ['*']) + return mod.Debian(config, setup) + elif toolset == 'rh': + if setup['verbose']: + print 'Selected RedHat Toolset...' + mod = __import__("Bcfg2.Client.Redhat",globals(), locals(), ['*']) + return mod.Redhat(config, setup) + else: + print "Toolset not correctly provided by the server." + sysexit(1) + def RunProbe(probe): '''Execute probe''' @@ -91,6 +105,9 @@ if __name__ == '__main__': print "got error from server" sysexit(1) + # Get toolset from server + toolset = cfg.get('toolset') + if setup['bundle']: c = Element("Configuration", version='2.0') for child in cfg.getroot().getchildren(): @@ -98,7 +115,9 @@ if __name__ == '__main__': c.append(child) cfg = c - client = Debian(cfg, setup) + # Create toolset handle + client = loadToolset(toolset, cfg, setup) + # verify state client.Inventory() -- cgit v1.2.3-1-g7c22