From e4ad61d5d8ea801e1a67f94db7862e9ebda7fe0d Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Tue, 25 Aug 2026 16:52:04 +0200 Subject: [PATCH] fix: Make genericOptions a list This fixes that only the last `-o` option takes effect for the pilot. --- Pilot/pilotCommands.py | 9 ++++----- Pilot/pilotTools.py | 4 ++-- Pilot/tests/Test_Pilot.py | 12 ++++++++++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Pilot/pilotCommands.py b/Pilot/pilotCommands.py index b6d9cef3..ce3490de 100644 --- a/Pilot/pilotCommands.py +++ b/Pilot/pilotCommands.py @@ -375,7 +375,7 @@ def execute(self): try: # In case we want to force local installation (in absence of CVMFS or for test reasons) - if "diracInstallOnly" in self.pp.genericOption: + if "diracInstallOnly" in self.pp.genericOptions: self.log.info("NOT sourcing: starting traditional DIRAC installation") self._localInstallDIRAC() return @@ -397,7 +397,7 @@ def execute(self): except OSError as e: self.log.error("Exception when trying to source the DIRAC environment: %s" % str(e)) - if "cvmfsOnly" in self.pp.genericOption: + if "cvmfsOnly" in self.pp.genericOptions: self.exitWithError(1) self.log.warn("Source of the DIRAC environment NOT DONE: starting traditional DIRAC installation") self._localInstallDIRAC() @@ -759,9 +759,8 @@ def execute(self): if self.pp.ceType: self.cfg.append("-o /LocalSite/LocalCE=%s" % self.pp.ceType) - for o, v in self.pp.optList: - if o == "-o" or o == "--option": - self.cfg.append('-o "%s"' % v) + for genericOption in self.pp.genericOptions: + self.cfg.append('-o "%s"' % genericOption) if self.pp.pilotReference: self.cfg.append("-o /LocalSite/PilotReference=%s" % self.pp.pilotReference) diff --git a/Pilot/pilotTools.py b/Pilot/pilotTools.py index 79af2d86..40153326 100644 --- a/Pilot/pilotTools.py +++ b/Pilot/pilotTools.py @@ -907,7 +907,7 @@ def __init__(self): self.gateway = "" self.useServerCertificate = False self.pilotScriptName = "" - self.genericOption = "" + self.genericOptions = [] self.wnVO = "" # for binding the resource (WN) to a specific VO # Some commands can define environment necessary to execute subsequent commands self.installEnv = os.environ @@ -1206,7 +1206,7 @@ def __initCommandLine2(self): elif o == "--pilotUUID": self.pilotUUID = v elif o in ("-o", "--option"): - self.genericOption = v + self.genericOptions.append(v) elif o in ("-t", "--tag"): self.tags.append(v) elif o == "--requiredTag": diff --git a/Pilot/tests/Test_Pilot.py b/Pilot/tests/Test_Pilot.py index cf701e4a..d2a326c7 100644 --- a/Pilot/tests/Test_Pilot.py +++ b/Pilot/tests/Test_Pilot.py @@ -105,6 +105,18 @@ def test_InitJSON(self): self.assertEqual(pp.commandOptions["b"], "2") self.assertEqual(pp.commandOptions["c"], "3") + sys.argv[1:] = [ + "--Name", + "grid1.example.com", + "--option", + "diracInstallOnly", + "-o", + "/LocalSite/Example=value", + ] + pp = PilotParams() + + self.assertEqual(pp.genericOptions, ["diracInstallOnly", "/LocalSite/Example=value"]) + sys.argv[1:] = [ "--Name", "grid1.example.com",