ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/CredentialRenew.py
Revision: 1.10
Committed: Tue May 11 14:01:08 2010 UTC (14 years, 11 months ago) by farinafa
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_9_1, CRAB_2_9_1_pre2, CRAB_2_9_1_pre1, CRAB_2_9_0, CRAB_2_9_0_pre2, CRAB_2_9_0_pre1, CRAB_2_8_8, CRAB_2_8_8_pre1, CRAB_2_8_7_patch3, CRAB_2_8_7_patch2, CRAB_2_8_7_patch1, CRAB_2_8_7, CRAB_2_8_7_pre2, CRAB_2_8_7_pre1, CRAB_2_8_6, CRAB_2_8_6_pre1, CRAB_2_8_5_patch3, CRAB_2_8_5_patch2, CRAB_2_8_5_patch1, CRAB_2_8_5, CRAB_2_8_5_pre5, CRAB_2_8_5_pre4, CRAB_2_8_5_pre3, CRAB_2_8_4_patch3, CRAB_2_8_5_pre2, CRAB_2_8_4_patch2, CRAB_2_8_5_pre1, CRAB_2_8_4_patch1, CRAB_2_8_4, CRAB_2_8_4_pre5, CRAB_2_8_4_pre4, CRAB_2_8_4_pre3, CRAB_2_8_4_pre2, CRAB_2_8_4_pre1, CRAB_2_8_3, CRAB_2_8_3_pre4, CRAB_2_8_3_pre3, CRAB_2_8_3_pre2, CRAB_2_8_3_pre1, CRAB_2_8_2_patch1, CRAB_2_8_2, CRAB_2_8_2_pre5, CRAB_2_8_2_pre4, CRAB_2_8_2_pre3, CRAB_2_8_2_pre2, CRAB_2_8_2_pre1, CRAB_2_8_1, CRAB_2_8_0, CRAB_2_8_0_pre1, CRAB_2_7_10_pre3, CRAB_2_7_9_patch2_pre1, CRAB_2_7_10_pre2, CRAB_2_7_10_pre1, CRAB_2_7_9_patch1, CRAB_2_7_9, CRAB_2_7_9_pre5, CRAB_2_7_9_pre4, CRAB_2_7_9_pre3, CRAB_2_7_9_pre2, CRAB_2_7_8_patch2, CRAB_2_7_9_pre1, CRAB_2_7_8_patch2_pre1, CRAB_2_7_8_patch1, CRAB_2_7_8_patch1_pre1, CRAB_2_7_8, CRAB_2_7_8_pre3, CRAB_2_7_8_pre2, CRAB_2_7_8_dash3, CRAB_2_7_8_dash2, CRAB_2_7_8_dash, CRAB_2_7_7_patch1, CRAB_2_7_7_patch1_pre1, CRAB_2_7_8_pre1, CRAB_2_7_7, CRAB_2_7_7_pre2, CRAB_2_7_7_pre1, CRAB_2_7_6_patch1, CRAB_2_7_6, CRAB_2_7_6_pre1, CRAB_2_7_5_patch1, CRAB_2_7_5, CRAB_2_7_5_pre3, CRAB_2_7_5_pre2, CRAB_2_7_5_pre1, CRAB_2_7_4_patch1, CRAB_2_7_4, CRAB_2_7_4_pre6, CRAB_2_7_4_pre5, CRAB_2_7_4_pre4, CRAB_2_7_4_pre3, CRAB_2_7_4_pre2, CRAB_2_7_4_pre1, CRAB_2_7_3, CRAB_2_7_3_pre3, CRAB_2_7_3_pre3_beta, CRAB_2_7_3_pre2, CRAB_2_7_3_pre2_beta, CRAB_2_7_3_pre1, CRAB_2_7_3_beta3, CRAB_2_7_3_beta2, CRAB_2_7_3_beta1, CRAB_2_7_3_beta, HEAD
Changes since 1.9: +1 -0 lines
Log Message:
Missing strip for myproxy server name

File Contents

# Content
1 from Actor import *
2 from crab_util import *
3 import common
4 import traceback
5 from ProdCommon.Credential.CredentialAPI import CredentialAPI
6 from SubmitterServer import SubmitterServer
7
8
9 class CredentialRenew(Actor):
10
11 def __init__(self, cfg_params):
12 self.cfg_params=cfg_params
13 self.credentialType = 'Proxy'
14 if common.scheduler.name().upper() in ['LSF', 'CAF']:
15 self.credentialType = 'Token'
16
17 # init client server params...
18 CliServerParams(self)
19
20 def run(self):
21 """
22 """
23
24 common.logger.debug("CredentialRenew::run() called")
25
26 # FIXME With MyProxy delegation this part is completely overlapped with the method manageDelegation
27 # in SubmitServer. We should to maintain just one version of the method in a common part
28
29 try:
30 myproxyserver = Downloader("http://cmsdoc.cern.ch/cms/LCG/crab/config/").config("myproxy_server.conf")
31 myproxyserver = myproxyserver.strip()
32 if myproxyserver is None:
33 raise CrabException("myproxy_server.conf retrieved but empty")
34 except Exception, e:
35 common.logger.info("Problem setting myproxy server endpoint: using myproxy.cern.ch")
36 common.logger.debug(e)
37 myproxyserver = 'myproxy.cern.ch'
38
39 configAPI = {'credential' : self.credentialType, \
40 'myProxySvr' : myproxyserver,\
41 'serverDN' : self.server_dn,\
42 'shareDir' : common.work_space.shareDir() ,\
43 'userName' : getUserName(),\
44 'serverName' : self.server_name, \
45 'logger' : common.logger() \
46 }
47 try:
48 CredAPI = CredentialAPI( configAPI )
49 except Exception, err :
50 common.logger.debug( "Configuring Credential API: " +str(traceback.format_exc()))
51 raise CrabException("ERROR: Unable to configure Credential Client API %s\n"%str(err))
52
53 if self.credentialType == 'Proxy':
54 # Proxy delegation through MyProxy, 4 days lifetime minimum
55 if not CredAPI.checkMyProxy(Time=4, checkRetrieverRenewer=True) :
56 common.logger.info("Please renew MyProxy delegated proxy:\n")
57 try:
58 CredAPI.credObj.serverDN = self.server_dn
59 CredAPI.ManualRenewMyProxy()
60 except Exception, ex:
61 common.logger.debug("Delegating Credentials to MyProxy : " +str(traceback.format_exc()))
62 raise CrabException(str(ex))
63 else:
64 self.renewer()
65 if not CredAPI.checkCredential(Time=100) :
66 common.logger.info("Please renew your %s :\n"%self.credentialType)
67 try:
68 CredAPI.ManualRenewCredential()
69 except Exception, ex:
70 raise CrabException(str(ex))
71 try:
72 dict = CredAPI.registerCredential()
73 except Exception, err:
74 common.logger.debug( "Registering Credentials : " +str(traceback.format_exc()))
75 raise CrabException("ERROR: Unable to register %s delegating server: %s\n"%\
76 (self.credentialType,self.server_name ))
77
78 common.logger.info("Credential successfully delegated to the server.\n")
79 return