Skip to content

Commit

Permalink
Merge pull request #4015 from qunox/versionControl
Browse files Browse the repository at this point in the history
add incomptible version warning
  • Loading branch information
mmascher committed Feb 17, 2014
2 parents feb8e0c + dac74f3 commit 04bbda3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/python/CRABClient/Commands/SubCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from CRABClient.client_exceptions import ConfigurationException, MissingOptionException
from CRABClient.ClientMapping import mapping
from CRABClient.CredentialInteractions import CredentialInteractions
from CRABClient.__init__ import __version__
from CRABClient.client_utilities import colors

from WMCore.Configuration import loadConfigurationFile, Configuration

Expand Down Expand Up @@ -130,6 +132,7 @@ def __init__(self, logger, cmdargs = []):
self.logfile = ''
self.logger.debug("Executing command: '%s'" % str(self.name))


##Get the mapping
self.loadMapping()

Expand Down Expand Up @@ -162,7 +165,9 @@ def __init__(self, logger, cmdargs = []):
if not hasattr(self, 'serverurl'):
self.instance, self.serverurl = self.serverInstance()


self.handleProxy(self.getUrl(self.instance, resource='info'))
self.checkversion(self.getUrl(self.instance, resource='info'))
self.uri = self.getUrl(self.instance)
self.logger.debug("Instance is %s" %(self.instance))
self.logger.debug("Server base url is %s" %(self.serverurl))
Expand All @@ -187,6 +192,15 @@ def serverInstance(self):
return instance, serverurl
raise ConfigurationException("No correct instance or no server specified")

def checkversion(self, baseurl=None):

compatibleversion = server_info('version', self.serverurl, self.proxyfilename, baseurl)

if __version__ in compatibleversion:
self.logger.debug("CRABClient version : %s Compatible" % __version__ )
else:
self.logger.info(colors.RED+"WARNING : INCOMPATIBLE CRABClient VERSION : %s " % __version__ +colors.NORMAL)

def handleProxy(self, baseurl=None):
""" Init the user proxy, and delegate it if necessary.
"""
Expand All @@ -198,6 +212,8 @@ def handleProxy(self, baseurl=None):

#get the dn of the agents from the server
alldns = server_info('delegatedn', self.serverurl, self.proxyfilename, baseurl)


for serverdn in alldns['services']:
proxy.defaultDelegation['serverDN'] = serverdn
proxy.defaultDelegation['myProxySvr'] = 'myproxy.cern.ch'
Expand Down

0 comments on commit 04bbda3

Please sign in to comment.