summaryrefslogtreecommitdiffstats
path: root/src/sbin
diff options
context:
space:
mode:
authorBrian Pellin <bpellin@mcs.anl.gov>2005-01-06 20:50:12 +0000
committerBrian Pellin <bpellin@mcs.anl.gov>2005-01-06 20:50:12 +0000
commit0adf63e1c4581d8c0d8f9979696e9e605c9f8d28 (patch)
treee997f89deb888d9a2b81557d4ba7bdbda9980182 /src/sbin
parente0be8588eb8fec754f88a50d42f95ae6a1983bdc (diff)
downloadbcfg2-0adf63e1c4581d8c0d8f9979696e9e605c9f8d28.tar.gz
bcfg2-0adf63e1c4581d8c0d8f9979696e9e605c9f8d28.tar.bz2
bcfg2-0adf63e1c4581d8c0d8f9979696e9e605c9f8d28.zip
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
Diffstat (limited to 'src/sbin')
-rw-r--r--src/sbin/bcfg223
1 files changed, 21 insertions, 2 deletions
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()