Trivial change to add support for non-PLC aggregates
authorSapan Bhatia <sapanb@cs.princeton.edu>
Mon, 21 Sep 2009 20:34:48 +0000 (20:34 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Mon, 21 Sep 2009 20:34:48 +0000 (20:34 +0000)
sfa/plc/api.py
sfa/util/config.py

index cf311e2..a1e702f 100644 (file)
@@ -117,8 +117,12 @@ class GeniAPI:
         self.key_file = key_file
         self.cert_file = cert_file
         self.credential = None
-        self.plshell = self.getPLCShell()
-        self.plshell_version = self.getPLCShellVersion()
+        
+        # Initialize the PLC shell only if SFA wraps a myPLC
+        if (self.config.get_aggregate_rspec_type() == 'pl'):
+            self.plshell = self.getPLCShell()
+            self.plshell_version = self.getPLCShellVersion()
+
         self.hrn = self.config.SFA_INTERFACE_HRN
         self.time_format = "%Y-%m-%d %H:%M:%S"
         self.logger=get_sfa_logger()
index 1c0b9c9..919c348 100644 (file)
@@ -41,15 +41,6 @@ class Config:
         except IOError, e:
             raise IOError, "Could not find the configuration file: %s" % config_file
 
-    ##
-    #
-    # Very hacky - to change after July 21.
-    # 
-    # The generation/parsing of RSpecs is based on the value returned by this function. vini and max
-    # use some new code, while pl uses old code. As long as you don't set SFA_AGGREGATE_RSPEC_TYPE in your
-    # config file, the new code will not apply to your deployment.
-    #
-
     def get_aggregate_rspec_type(self):
         if (hasattr(self,'SFA_AGGREGATE_RSPEC_TYPE')):
             return self.SFA_AGGREGATE_RSPEC_TYPE