From 9d7bad2b59e48dbbf71a8fda17682fac46c8da99 Mon Sep 17 00:00:00 2001 From: Simon Fayer Date: Thu, 23 Nov 2023 15:56:14 +0000 Subject: [PATCH] fix: Use copy+remove in pilotsync agent to avoid SELinux problems --- src/DIRAC/WorkloadManagementSystem/Agent/PilotSyncAgent.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DIRAC/WorkloadManagementSystem/Agent/PilotSyncAgent.py b/src/DIRAC/WorkloadManagementSystem/Agent/PilotSyncAgent.py index 386b6336862..718d84aecb8 100644 --- a/src/DIRAC/WorkloadManagementSystem/Agent/PilotSyncAgent.py +++ b/src/DIRAC/WorkloadManagementSystem/Agent/PilotSyncAgent.py @@ -98,7 +98,9 @@ def execute(self): self.log.info("Moving pilot files", f"to {self.saveDir}") for tf in allFiles: # this overrides the destinations - shutil.move(tf, os.path.join(self.saveDir, os.path.basename(tf))) + # use copy & remove rather than move to reset SELinux context on files + shutil.copy(tf, os.path.join(self.saveDir, os.path.basename(tf))) + os.remove(tf) # Here, attempting upload somewhere, and somehow for server in self.uploadLocations: