dmwm/CRABClient — pull request #4171 by AndresTanasijczuk (2014-07-08 11:25:55+00:00)
Title: Use non-empty file in checkwrite. Improve checkwrite messages.

Notice that most of the changes are cosmetic.
The one relevant change is to use a non-empty file in lcg-cp. Plus I improved a bit (IMO) the interpretation of the lcg-cp errors and the output messages to the user. When I say that I improved the interpretation of the lcg-cp errors, I mean that: I ask if the err message from lcg-cp contains either "Permission denied" or "mkdir: cannot create directory" and in that case I set exitcode = 1 and that's it, the user does not have write permission. Otherwise we do the check that was done before: if the err or out messages from lcg-cp contain "exist", we assume the message means that the destination file already exists, try to delete it and try lcg-cp again. I also changed the exitcode to -1 for a timeout in lcg-cp, and in that case we don't print "Error: Unable to write on site ", but "Unable to check write permission on site ". Thus, at the end of the checkwrite, the command prints either:
•	"Error: Unable to write on site ", or
•	"Success: Able to write on site ", or
•	"Unable to check write permission on site ".
I did crab checkwrite on all T2 sites plus T3_US_FNALLPC (in total 54 sites), and I get success in 37 of them. From the other 17 sites, the Malaysian site T2_MY_UPM_BIRUNI (I guess is not operational yet?) gives me "Error: Failed to get PFN from the site. Please check the site status" From the other 16 sites, I consider that 12 of them (T2_BR_UERJ, T2_DE_DESY, T2_ES_CIEMAT, T2_FI_HIP, T2_FR_GRIF_LLR, T2_TH_CUNSTDA, T2_UK_London_IC, T2_US_Caltech, T2_US_Florida, T2_US_Purdue, T2_US_UCSD, T3_US_FNALLPC) are correctly reported by the checkwrite command as "Error: Unable to write on site ", because the err message from the lcg-cp contains the phrase "Permission denied" and/or "mkdir: cannot create directory". Then, there are 4 sites (T2_BE_UCL, T2_GR_Ioannina, T2_IT_Bari, T2_RU_SINP) where the err message from lcg-cp doesn't contain "Permission denied" or "mkdir: cannot create directory", and I don't know if concluding that the user has no write permission is correct or not, but we still print "Error: Unable to write on site ".
I put the outputs that I got from the crab checkwrite test for all sites in a file in /afs/cern.ch/user/a/atanasi/public/checkwrite_test/checkwrite_all_sites.txt You can look at it yourself.

This patch is to fix issue #4164