diff --git a/bin/crab.py b/bin/crab.py index fafdfc97..ea3fe309 100755 --- a/bin/crab.py +++ b/bin/crab.py @@ -7,6 +7,7 @@ - exit with the proper exit codes """ from __future__ import print_function +from __future__ import division import sys if sys.version_info < (2, 6): print('\nError: using a version of python < 2.6. Exiting...\n') diff --git a/src/python/CRABClient/CredentialInteractions.py b/src/python/CRABClient/CredentialInteractions.py index 79a2ad9e..0e3306ba 100644 --- a/src/python/CRABClient/CredentialInteractions.py +++ b/src/python/CRABClient/CredentialInteractions.py @@ -87,6 +87,8 @@ def createNewVomsProxy(self, timeLeftThreshold=0, proxyCreatedByCRAB=False, prox proxyTimeLeft = 0 else: self.logger.debug("Found proxy file %s" % (proxyFileName)) + self.logger.debug("Making sure it has proper VOMS extension") + proxy.validateVO() self.logger.debug("Getting proxy life time left") proxyTimeLeft = proxy.getTimeLeft() hours, minutes, seconds = int(proxyTimeLeft/3600), int((proxyTimeLeft%3600)/60), int((proxyTimeLeft%3600)%60) diff --git a/src/python/CRABClient/ProxyInteractions.py b/src/python/CRABClient/ProxyInteractions.py index 9c49238d..627a3686 100644 --- a/src/python/CRABClient/ProxyInteractions.py +++ b/src/python/CRABClient/ProxyInteractions.py @@ -58,6 +58,19 @@ def setVOGroupVORole(self, group, role): def getFilename(self): return self.proxyFile + def validateVO(self): + # make sure that proxy has a VOMS extension for CMS VirtualOrganization + cmd = 'voms-proxy-info --vo --file %s' % self.proxyFile + stdout, stderr, rc = execute_command(cmd, logger=self.logger) + if rc != 0 or 'cms' not in stdout: + msg = "\n".join(['Error executing %s:' % cmd, stdout, stderr]) + self.logger.error(msg) + msg = 'proxy %s is not a valid proxy file or has no valid VOMS extension.\n' % self.proxyFile + stdout, stderr, rc = execute_command('voms-proxy-info -all', logger=self.logger) + msg += 'output of voms-proxy-info -all is\n%s' % (stdout+'\n'+stderr) + msg += '\n**** Make sure you do voms-proxy-init -voms cms ****\n' + raise ProxyCreationException(msg) + def getTimeLeft(self): cmd = 'voms-proxy-info --actimeleft --timeleft --file %s' % self.proxyFile stdout, stderr, rc = execute_command(cmd, logger=self.logger) diff --git a/src/python/CRABClient/WMCoreConfigWrapper.py b/src/python/CRABClient/WMCoreConfigWrapper.py index 3a05bc13..dcce1130 100644 --- a/src/python/CRABClient/WMCoreConfigWrapper.py +++ b/src/python/CRABClient/WMCoreConfigWrapper.py @@ -17,6 +17,7 @@ dependencies which are not available in CMSSW_8 or earlier, e.g. "future" """ +from __future__ import division from CRABClient.Configuration import Configuration as Config from CRABClient.ClientUtilities import colors diff --git a/src/python/CRABClient/WMCoreConfiguration.py b/src/python/CRABClient/WMCoreConfiguration.py index 70930328..5fdde5a5 100644 --- a/src/python/CRABClient/WMCoreConfiguration.py +++ b/src/python/CRABClient/WMCoreConfiguration.py @@ -11,6 +11,7 @@ Module dealing with Configuration file in python format """ +from __future__ import division import imp import os import sys