summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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: