From 48a0eceadc2fdd6b6094e3c2638aa321241a1edc Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Thu, 13 Oct 2005 18:55:00 +0000 Subject: add support for multiple communication protocols (Logical change 1.336) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1373 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index 0c2c59535..175e5cc39 100644 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -8,11 +8,10 @@ from os import popen, chmod, unlink, _exit from signal import signal, SIGINT from sys import argv from tempfile import mktemp +from ConfigParser import ConfigParser from elementtree.ElementTree import Element, XML, tostring -from sss.ssslib import comm_lib - def cb_sigint_handler(signum, frame): '''Exit upon CTRL-C''' raise _exit(1) @@ -92,6 +91,21 @@ if __name__ == '__main__': print "Failed to read cached config file: %s" % (setup['file']) raise SystemExit, 1 else: + try: + cf = ConfigParser() + cf.read('/etc/bcfg2.conf') + proto = cf.get('communication', 'protocol') + except: + proto = 'sss' + + if proto == 'sss': + from sss.ssslib import comm_lib + elif proto == 'xmlrpc/ssl': + from Bcfg2.Client.XMLRPCComm import comm_lib + else: + print "Unsupported protocol: %s" % proto + raise SystemExit, 1 + # connect to bcfg2d comm = comm_lib() try: -- cgit v1.2.3-1-g7c22