no longer need getPLCSHellVersion()
[sfa.git] / sfa / plc / api.py
index 551f7ea..ded4fad 100644 (file)
@@ -26,7 +26,6 @@ def list_to_dict(recs, key):
     keys = [rec[key] for rec in recs]
     return dict(zip(keys, recs))
 
-
 class SfaAPI(BaseAPI):
 
     # flat list of method names
@@ -60,7 +59,7 @@ class SfaAPI(BaseAPI):
         rspec_type = self.config.get_aggregate_type()
         if (rspec_type == 'pl' or rspec_type == 'vini'):
             self.plshell = self.getPLCShell()
-            self.plshell_version = self.getPLCShellVersion()
+            self.plshell_version = "4.3"
 
         self.hrn = self.config.SFA_INTERFACE_HRN
         self.time_format = "%Y-%m-%d %H:%M:%S"
@@ -70,36 +69,20 @@ class SfaAPI(BaseAPI):
         self.plauth = {'Username': self.config.SFA_PLC_USER,
                        'AuthMethod': 'password',
                        'AuthString': self.config.SFA_PLC_PASSWORD}
+
         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())
-            shell.AuthCheck(self.plauth)
             return shell
         except ImportError:
             self.plshell_type = 'xmlrpc' 
             # connect via xmlrpc
             url = self.config.SFA_PLC_URL
             shell = xmlrpclib.Server(url, verbose = 0, allow_none = True)
-            shell.AuthCheck(self.plauth)
             return shell
 
-    def getPLCShellVersion(self):
-        # We need to figure out what version of PLCAPI we are talking to.
-        # Some calls we need to make later will be different depending on
-        # the api version. 
-        try:
-            # This is probably a bad way to determine api versions
-            # but its easy and will work for now. Lets try to make 
-            # a call that only exists is PLCAPI.4.3. If it fails, we
-            # can assume the api version is 4.2
-            self.plshell.GetTagTypes(self.plauth)
-            return '4.3'
-        except:
-            return '4.2'
-            
-
     def getCredential(self):
         if self.interface in ['registry']:
             return self.getCredentialFromLocalRegistry()
@@ -403,6 +386,9 @@ class SfaAPI(BaseAPI):
 
         # fill sfa info
         for record in records:
+            # skip records with no pl info (top level authorities)
+            if record['pointer'] == -1:
+                continue 
             sfa_info = {}
             type = record['type']
             if (type == "slice"):