From 5dc1b9b9f665c178dff5a43b2d6a009a65a5a653 Mon Sep 17 00:00:00 2001
From: Gerardo Ganis <gerardo.ganis@cern.ch>
Date: Tue, 1 Nov 2022 13:54:18 +0100
Subject: [PATCH] Consolidate check on xrdcp 'failure' because file is existing

---
 jenkins/complete_rpms_actions.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/jenkins/complete_rpms_actions.py b/jenkins/complete_rpms_actions.py
index 52a6ceaca3..60f64fbb0a 100755
--- a/jenkins/complete_rpms_actions.py
+++ b/jenkins/complete_rpms_actions.py
@@ -72,7 +72,10 @@ def copy_to_eos(from_mask, to, dryrun):
                 try:
                     subprocess.check_output(shlex.split(command), stderr=subprocess.STDOUT)
                 except subprocess.CalledProcessError as e:
-                    if e.returncode == 54:
+                    eossrv = to.rsplit('//', 1)[0]
+                    eosfnm = '/' + to.rsplit('//', 1)[1] + os.path.basename(from_file)
+                    rc = subprocess.run(['xrdfs', eossrv, 'ls', '-1', eosfnm])
+                    if rc.returncode == 0:
                         print("\t[EXISTS]")
                         break
                     else:
-- 
GitLab