summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2005-10-13 18:55:00 +0000
committerNarayan Desai <desai@mcs.anl.gov>2005-10-13 18:55:00 +0000
commit48a0eceadc2fdd6b6094e3c2638aa321241a1edc (patch)
treeb7465b4ee9b7eefd7b98b098beca6a2789940aa3 /src
parentae0830acb4c9d859842401148fff7e067424bb04 (diff)
downloadbcfg2-48a0eceadc2fdd6b6094e3c2638aa321241a1edc.tar.gz
bcfg2-48a0eceadc2fdd6b6094e3c2638aa321241a1edc.tar.bz2
bcfg2-48a0eceadc2fdd6b6094e3c2638aa321241a1edc.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/sbin/bcfg218
1 files changed, 16 insertions, 2 deletions
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: