From: Tony Mack Date: Tue, 12 May 2009 18:25:45 +0000 (+0000) Subject: added getPLCShellVersion to help figure out which version of plcapi we are talking to X-Git-Tag: sfa-0.9-0@14641~391 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=5ca5c4fb094cea4f2089c165a25558f0547e71d3;p=sfa.git added getPLCShellVersion to help figure out which version of plcapi we are talking to --- diff --git a/geni/util/api.py b/geni/util/api.py index e3ca0ec4..800840bc 100644 --- a/geni/util/api.py +++ b/geni/util/api.py @@ -112,6 +112,7 @@ class GeniAPI: self.cert_file = cert_file self.credential = None self.plshell = self.getPLCShell() + self.plshell_version = self.getPLCShellVersion() self.basedir = self.config.GENI_BASE_DIR + os.sep self.server_basedir = self.basedir + os.sep + "geni" + os.sep self.hrn = self.config.GENI_INTERFACE_HRN @@ -139,6 +140,21 @@ class GeniAPI: shell.AuthCheck(self.plauth) return shell + def getPLCShellVersion(self): + # We need to figure out what version of PLCAPI are talking to. + # Some calls we need to make later will be different depending + # 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()