Skip to content

Commit b32d450

Browse files
committed
fix return code handling in stashcp
doStashCpSingle() was inconsistent in whether its return value indicated error or success. The messed up return code worked its way down to the exit status for the script. I'm fixing this by making doStashCpSingle & dostashcpdirectory just return the error status - 0 for success, 1 for failure
1 parent 7150d2d commit b32d450

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

stashcp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def doStashCpSingle(sourceFile, destination, methods, debug=False):
240240
payload['status'] = 'Fail'
241241

242242
es_send(payload)
243-
return success
243+
return 0 if success else 1
244244

245245

246246
def download_cvmfs(sourceFile, destination, debug, payload):
@@ -459,6 +459,7 @@ def dostashcpdirectory(sourceDir, destination, methods, debug=False):
459459
# Stop transfers if something fails
460460
if result != 0:
461461
return result
462+
return 0
462463

463464

464465
def es_send(payload):
@@ -705,7 +706,7 @@ def main():
705706
else:
706707
result = dostashcpdirectory(sourceDir = source, destination = destination, methods = methods, debug=args.debug)
707708
# Exit with failure
708-
sys.exit(0 if result else 1)
709+
sys.exit(result)
709710

710711

711712
if __name__ == "__main__":

0 commit comments

Comments
 (0)