2 |
|
from crab_logger import Logger |
3 |
|
from crab_exceptions import * |
4 |
|
from crab_util import * |
5 |
+ |
from EdgConfig import * |
6 |
|
import common |
7 |
|
|
8 |
|
import os, sys, time |
765 |
|
""" |
766 |
|
if (self.proxyValid): return |
767 |
|
timeleft = -999 |
768 |
< |
minTimeLeft=10 # in hours |
769 |
< |
cmd = 'voms-proxy-info -exists -valid '+str(minTimeLeft)+':00' |
770 |
< |
# SL Here I have to use os.system since the stupid command exit with >0 if no valid proxy is found |
771 |
< |
cmd_out = os.system(cmd) |
772 |
< |
if (cmd_out>0): |
768 |
> |
minTimeLeft=10*3600 # in seconds |
769 |
> |
#cmd = 'voms-proxy-info -exists -valid '+str(minTimeLeft)+':00' |
770 |
> |
#cmd = 'voms-proxy-info -timeleft' |
771 |
> |
mustRenew = 0 |
772 |
> |
timeLeftLocal = runCommand('voms-proxy-info -timeleft') |
773 |
> |
timeLeftServer = -999 |
774 |
> |
if not timeLeftLocal or not isInt(timeLeftLocal): |
775 |
> |
mustRenew = 1 |
776 |
> |
else: |
777 |
> |
timeLeftServer = runCommand('voms-proxy-info -actimeleft') |
778 |
> |
if not timeLeftServer or not isInt(timeLeftServer): |
779 |
> |
mustRenew = 1 |
780 |
> |
elif timeLeftServer<minTimeLeft or timeLeftServer<minTimeLeft: |
781 |
> |
mustRenew = 1 |
782 |
> |
pass |
783 |
> |
pass |
784 |
> |
|
785 |
> |
if (mustRenew): |
786 |
|
common.logger.message( "No valid proxy found or timeleft too short!\n Creating a user proxy with default length of 24h\n") |
787 |
|
cmd = 'voms-proxy-init -voms cms -valid 100:00' |
788 |
|
try: |
792 |
|
except: |
793 |
|
msg = "Unable to create a valid proxy!\n" |
794 |
|
raise CrabException(msg) |
781 |
– |
# cmd = 'grid-proxy-info -timeleft' |
782 |
– |
# cmd_out = runCommand(cmd,0,20) |
795 |
|
pass |
796 |
|
self.proxyValid=1 |
797 |
|
return |