38 |
|
common.logger.debug(5,'Setting myproxy server to '+self.proxyServer) |
39 |
|
|
40 |
|
try: |
41 |
+ |
self.group = cfg_params["EDG.group"] |
42 |
+ |
except KeyError: |
43 |
+ |
self.group = None |
44 |
+ |
|
45 |
+ |
try: |
46 |
|
self.role = cfg_params["EDG.role"] |
47 |
|
except KeyError: |
48 |
|
self.role = None |
71 |
|
except KeyError: self.VO = 'cms' |
72 |
|
|
73 |
|
try: self.return_data = cfg_params['USER.return_data'] |
74 |
< |
except KeyError: self.return_data = 1 |
74 |
> |
except KeyError: self.return_data = 0 |
75 |
|
|
76 |
|
try: |
77 |
|
self.copy_data = cfg_params["USER.copy_data"] |
443 |
|
txt += ' export X509_CERT_DIR=$OSG_APP/glite/etc/grid-security/certificates\n' |
444 |
|
txt += ' echo "export X509_CERT_DIR=$X509_CERT_DIR"\n' |
445 |
|
txt += ' fi \n' |
446 |
+ |
|
447 |
|
txt += ' for out_file in $file_list ; do\n' |
448 |
< |
txt += ' echo "Trying to copy output file to $SE using lcg-cp"\n' |
449 |
< |
if common.logger.debugLevel() >= 5: |
450 |
< |
txt += ' echo "lcg-cp --vo $VO -t 2400 --verbose file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
451 |
< |
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 --verbose file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
452 |
< |
else: |
453 |
< |
txt += ' echo "lcg-cp --vo $VO -t 2400 file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
454 |
< |
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
448 |
> |
txt += ' echo "Trying to copy output file to $SE using srmcp"\n' |
449 |
> |
txt += ' echo "mkdir -p $HOME/.srmconfig"\n' |
450 |
> |
txt += ' mkdir -p $HOME/.srmconfig\n' |
451 |
> |
txt += ' if [ $middleware == LCG ]; then\n' |
452 |
> |
txt += ' echo "srmcp -retry_num 3 -retry_timeout 480000 file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
453 |
> |
txt += ' exitstring=`srmcp -retry_num 3 -retry_timeout 480000 file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
454 |
> |
txt += ' elif [ $middleware == OSG ]; then\n' |
455 |
> |
txt += ' echo "srmcp -retry_num 3 -retry_timeout 240000 -x509_user_trusted_certificates $X509_CERT_DIR file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
456 |
> |
txt += ' exitstring=`srmcp -retry_num 3 -retry_timeout 240000 -x509_user_trusted_certificates $X509_CERT_DIR file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
457 |
> |
txt += ' fi \n' |
458 |
|
txt += ' copy_exit_status=$?\n' |
459 |
< |
txt += ' echo "COPY_EXIT_STATUS for lcg-cp = $copy_exit_status"\n' |
459 |
> |
txt += ' echo "COPY_EXIT_STATUS for srmcp = $copy_exit_status"\n' |
460 |
|
txt += ' echo "STAGE_OUT = $copy_exit_status"\n' |
461 |
+ |
|
462 |
|
txt += ' if [ $copy_exit_status -ne 0 ]; then\n' |
463 |
|
txt += ' echo "Possible problem with SE = $SE"\n' |
464 |
|
txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n' |
465 |
|
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n' |
466 |
< |
txt += ' echo "lcg-cp failed. For verbose lcg-cp output, use command line option -debug 5."\n' |
467 |
< |
txt += ' echo "lcg-cp failed, attempting srmcp"\n' |
468 |
< |
txt += ' echo "mkdir -p $HOME/.srmconfig"\n' |
469 |
< |
txt += ' mkdir -p $HOME/.srmconfig\n' |
470 |
< |
txt += ' if [ $middleware == LCG ]; then\n' |
471 |
< |
txt += ' echo "srmcp -retry_num 5 -retry_timeout 480000 file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
472 |
< |
txt += ' exitstring=`srmcp -retry_num 5 -retry_timeout 480000 file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
463 |
< |
txt += ' elif [ $middleware == OSG ]; then\n' |
464 |
< |
txt += ' echo "srmcp -retry_num 5 -retry_timeout 240000 -x509_user_trusted_certificates $OSG_APP/glite/etc/grid-security/certificates file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
465 |
< |
txt += ' exitstring=`srmcp -retry_num 5 -retry_timeout 240000 -x509_user_trusted_certificates $OSG_APP/glite/etc/grid-security/certificates file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
466 |
< |
txt += ' fi \n' |
466 |
> |
txt += ' echo "srmcp failed, attempting lcg-cp."\n' |
467 |
> |
if common.logger.debugLevel() >= 5: |
468 |
> |
txt += ' echo "lcg-cp --vo $VO -t 2400 --verbose file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
469 |
> |
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 --verbose file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
470 |
> |
else: |
471 |
> |
txt += ' echo "lcg-cp --vo $VO -t 2400 file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
472 |
> |
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
473 |
|
txt += ' copy_exit_status=$?\n' |
474 |
< |
txt += ' echo "COPY_EXIT_STATUS for srm = $copy_exit_status"\n' |
474 |
> |
txt += ' echo "COPY_EXIT_STATUS for lcg-cp = $copy_exit_status"\n' |
475 |
|
txt += ' echo "STAGE_OUT = $copy_exit_status"\n' |
476 |
+ |
|
477 |
|
txt += ' if [ $copy_exit_status -ne 0 ]; then\n' |
478 |
|
txt += ' echo "Problems with SE = $SE"\n' |
479 |
|
txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n' |
480 |
|
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n' |
481 |
< |
txt += ' echo "lcg-cp and srm failed"\n' |
475 |
< |
txt += ' echo "If storage_path in your config file contains a ? you may need a \? instead."\n' |
481 |
> |
txt += ' echo "srmcp and lcg-cp and failed!"\n' |
482 |
|
txt += ' else\n' |
483 |
|
txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n' |
484 |
|
txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n' |
485 |
|
txt += ' echo "output copied into $SE/$SE_PATH directory"\n' |
486 |
|
txt += ' echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n' |
487 |
< |
txt += ' echo "srmcp succeeded"\n' |
487 |
> |
txt += ' echo "lcg-cp succeeded"\n' |
488 |
|
txt += ' fi\n' |
489 |
|
txt += ' else\n' |
490 |
|
txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n' |
491 |
|
txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n' |
492 |
|
txt += ' echo "output copied into $SE/$SE_PATH directory"\n' |
493 |
|
txt += ' echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n' |
494 |
< |
txt += ' echo "lcg-cp succeeded"\n' |
494 |
> |
txt += ' echo "srmcp succeeded"\n' |
495 |
|
txt += ' fi\n' |
496 |
|
txt += ' done\n' |
497 |
|
return txt |
867 |
|
|
868 |
|
if mustRenew: |
869 |
|
common.logger.message( "No valid proxy found or remaining time of validity of already existing proxy shorter than 10 hours!\n Creating a user proxy with default length of 96h\n") |
870 |
< |
cmd = 'voms-proxy-init -voms '+self.VO+' -valid 96:00' |
870 |
> |
cmd = 'voms-proxy-init -voms '+self.VO |
871 |
> |
if self.group: |
872 |
> |
cmd += ':/'+self.VO+'/'+self.group |
873 |
|
if self.role: |
874 |
< |
cmd = 'voms-proxy-init -voms '+self.VO+':/'+self.VO+'/role='+self.role+' -valid 96:00' |
874 |
> |
cmd += '/role='+self.role |
875 |
> |
cmd += ' -valid 96:00' |
876 |
|
try: |
877 |
|
# SL as above: damn it! |
878 |
+ |
common.logger.debug(10,cmd) |
879 |
|
out = os.system(cmd) |
880 |
|
if (out>0): raise CrabException("Unable to create a valid proxy!\n") |
881 |
|
except: |