From d4d1f318bf057611704e85e9d7f62e6a96f89306 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Fri, 9 Jul 2010 20:18:44 +0000 Subject: [PATCH] attempt to use plc sshell before xmlrpc --- sfa/plc/api.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sfa/plc/api.py b/sfa/plc/api.py index c0c0d13d..aac86eb9 100644 --- a/sfa/plc/api.py +++ b/sfa/plc/api.py @@ -58,11 +58,8 @@ except: def __repr__(self): return 'defaultdict(%s, %s)' % (self.default_factory, dict.__repr__(self)) - - ## end of http://code.activestate.com/recipes/523034/ }}} - def list_to_dict(recs, key): """ convert a list of dictionaries into a dictionary keyed on the @@ -85,7 +82,6 @@ class SfaAPI(BaseAPI): cert_file=cert_file, cache=cache) self.encoding = encoding - from sfa.util.table import SfaTable self.SfaTable = SfaTable # Better just be documenting the API @@ -115,12 +111,16 @@ class SfaAPI(BaseAPI): self.plauth = {'Username': self.config.SFA_PLC_USER, 'AuthMethod': 'password', 'AuthString': self.config.SFA_PLC_PASSWORD} - - - self.plshell_type = 'xmlrpc' - # connect via xmlrpc - url = self.config.SFA_PLC_URL - shell = xmlrpclib.Server(url, verbose = 0, allow_none = True) + try: + sys.path.append(os.path.dirname(os.path.realpath("/usr/bin/plcsh"))) + self.plshell_type = 'direct' + import PLC.Shell + shell = PLC.Shell.Shell(globals = globals()) + except: + self.plshell_type = 'xmlrpc' + url = self.config.SFA_PLC_URL + shell = xmlrpclib.Server(url, verbose = 0, allow_none = True) + return shell def getCredential(self): -- 2.47.0