Skip to content

Commit 7d1766b

Browse files
authored
Merge pull request #270 from fstagni/use_preferredURLPattern
Use preferred url pattern
2 parents b302f5e + 63571e3 commit 7d1766b

File tree

6 files changed

+173
-157
lines changed

6 files changed

+173
-157
lines changed

.github/workflows/integration.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
sed -i "s#VAR_CS#https://lbcertifdirac70.cern.ch:9135/Configuration/Server#g" pilot.json
5454
sed -i "s#VAR_USERDN#/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=alboyer/CN=819281/CN=Alexandre Franck Boyer#g" pilot.json
5555
sed -i "s#VAR_USERDN_GRIDPP#${DIRACUSERDN_GRIDPP}#g" pilot.json
56+
sed -i "s#VAR_PREF_URL_PATTERN#.*\.cern\.ch/.*#g" pilot.json
5657
g_job="testintegrationworkflow${GITHUB_JOB//-/}"
5758
pilotUUID="${g_job//_/}""$(shuf -i 2000-65000 -n 1)"
5859
pilotUUID=$(echo $pilotUUID | rev | cut -c 1-32 | rev)
@@ -115,6 +116,7 @@ jobs:
115116
sed -i "s#VAR_CS#https://lbcertifdirac70.cern.ch:9135/Configuration/Server#g" pilot.json
116117
sed -i "s#VAR_USERDN#/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=alboyer/CN=819281/CN=Alexandre Franck Boyer#g" pilot.json
117118
sed -i "s#VAR_USERDN_GRIDPP#${DIRACUSERDN_GRIDPP}#g" pilot.json
119+
sed -i "s#VAR_PREF_URL_PATTERN#.*\.cern\.ch/.*#g" pilot.json
118120
g_job="testintegrationworkflow${GITHUB_JOB//-/}"
119121
pilotUUID="${g_job//_/}""$(shuf -i 2000-65000 -n 1)"
120122
pilotUUID=$(echo $pilotUUID | rev | cut -c 1-32 | rev)
@@ -164,6 +166,7 @@ jobs:
164166
sed -i "s#VAR_CS#https://lbcertifdirac70.cern.ch:9135/Configuration/Server#g" pilot.json
165167
sed -i "s#VAR_USERDN#/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=alboyer/CN=819281/CN=Alexandre Franck Boyer#g" pilot.json
166168
sed -i "s#VAR_USERDN_GRIDPP#${DIRACUSERDN_GRIDPP}#g" pilot.json
169+
sed -i "s#VAR_PREF_URL_PATTERN#.*\.cern\.ch/.*#g" pilot.json
167170
g_job="testintegrationworkflow${GITHUB_JOB//-/}"
168171
pilotUUID="${g_job//_/}""$(shuf -i 2000-65000 -n 1)"
169172
pilotUUID=$(echo $pilotUUID | rev | cut -c 1-32 | rev)
@@ -221,6 +224,7 @@ jobs:
221224
sed -i "s#VAR_CS#https://lbcertifdirac70.cern.ch:9135/Configuration/Server#g" pilot.json
222225
sed -i "s#VAR_USERDN#/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=alboyer/CN=819281/CN=Alexandre Franck Boyer#g" pilot.json
223226
sed -i "s#VAR_USERDN_GRIDPP#${DIRACUSERDN_GRIDPP}#g" pilot.json
227+
sed -i "s#VAR_PREF_URL_PATTERN#.*\.cern\.ch/.*#g" pilot.json
224228
g_job="testintegrationworkflow${GITHUB_JOB//-/}"
225229
pilotUUID="${g_job//_/}""$(shuf -i 2000-65000 -n 1)"
226230
pilotUUID=$(echo $pilotUUID | rev | cut -c 1-32 | rev)
@@ -273,6 +277,7 @@ jobs:
273277
sed -i "s#VAR_CS#https://lbcertifdirac70.cern.ch:9135/Configuration/Server#g" pilot.json
274278
sed -i "s#VAR_USERDN#/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=alboyer/CN=819281/CN=Alexandre Franck Boyer#g" pilot.json
275279
sed -i "s#VAR_USERDN_GRIDPP#${DIRACUSERDN_GRIDPP}#g" pilot.json
280+
sed -i "s#VAR_PREF_URL_PATTERN#.*\.cern\.ch/.*#g" pilot.json
276281
g_job="testintegrationworkflow${GITHUB_JOB//-/}"
277282
pilotUUID="${g_job//_/}""$(shuf -i 2000-65000 -n 1)"
278283
pilotUUID=$(echo $pilotUUID | rev | cut -c 1-32 | rev)
@@ -334,6 +339,7 @@ jobs:
334339
sed -i "s#VAR_CS#https://lbcertifdirac70.cern.ch:9135/Configuration/Server#g" pilot.json
335340
sed -i "s#VAR_USERDN#/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=alboyer/CN=819281/CN=Alexandre Franck Boyer#g" pilot.json
336341
sed -i "s#VAR_USERDN_GRIDPP#${DIRACUSERDN_GRIDPP}#g" pilot.json
342+
sed -i "s#VAR_PREF_URL_PATTERN#.*\.cern\.ch/.*#g" pilot.json
337343
g_job="testintegrationworkflow${GITHUB_JOB//-/}"
338344
pilotUUID="${g_job//_/}""$(shuf -i 2000-65000 -n 1)"
339345
pilotUUID=$(echo $pilotUUID | rev | cut -c 1-32 | rev)

Pilot/pilotCommands.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ def _getBasicsCFG(self):
508508
self.cfg.append('-S "%s"' % self.pp.setup)
509509
if self.pp.configServer:
510510
self.cfg.append('-C "%s"' % self.pp.configServer)
511+
if self.pp.preferredURLPatterns:
512+
self.cfg.append("-o /DIRAC/PreferredURLPatterns=%s" % quote(",".join(self.pp.preferredURLPatterns)))
511513
if self.pp.releaseProject:
512514
self.cfg.append('-e "%s"' % self.pp.releaseProject)
513515
self.cfg.append("-o /LocalSite/ReleaseProject=%s" % self.pp.releaseProject)
@@ -834,7 +836,7 @@ def execute(self):
834836
archScript = self.pp.architectureScript
835837
if self.pp.architectureScript.split(" ")[0] == "dirac-apptainer-exec":
836838
archScript = " ".join(self.pp.architectureScript.split(" ")[1:])
837-
839+
838840
architectureCmd = "%s %s -ddd" % (archScript, " ".join(cfg))
839841

840842
if self.pp.architectureScript.split(" ")[0] == "dirac-apptainer-exec":
@@ -872,10 +874,12 @@ def execute(self):
872874

873875
return localArchitecture
874876

877+
875878
class ConfigureArchitectureWithoutCLI(CommandBase):
876879
"""This command determines the platform.
877880
Separated from the ConfigureDIRAC command for easier extensibility.
878881
"""
882+
879883
def getPlatformString(self):
880884
# Modified to return our desired platform string, R. Graciani
881885
platformTuple = (platform.system(), platform.machine())
@@ -903,7 +907,6 @@ def execute(self):
903907
self.log.error("Configuration error [ERROR %s]" % str(e))
904908
self.exitWithError(1)
905909

906-
907910
cfg = ["-FDMH"] # force update, skip CA checks, skip CA download, skip VOMS
908911
if self.pp.useServerCertificate:
909912
cfg.append("--UseServerCertificate")

Pilot/pilotTools.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ def executeAndGetOutput(self, cmd, environDict=None):
793793
outChunk = outChunk.decode("utf-8")
794794
# Strip unicode replacement characters
795795
# Ensure correct type conversion in Python 2
796-
outChunk = str(outChunk.replace(u"\ufffd", ""))
796+
outChunk = str(outChunk.replace("\ufffd", ""))
797797
# Avoid potential str() issues in Py2
798798
outChunk = unicode(outChunk) # pylint: disable=undefined-variable
799799
else:
@@ -908,6 +908,7 @@ def __init__(self):
908908
self.site = ""
909909
self.setup = ""
910910
self.configServer = ""
911+
self.preferredURLPatterns = ""
911912
self.ceName = ""
912913
self.ceType = ""
913914
self.queueName = ""
@@ -1306,6 +1307,8 @@ def __initJSON2(self):
13061307
# the generic one (a list):
13071308
self.configServer = ",".join([str(pv).strip() for pv in self.pilotJSON["ConfigurationServers"]])
13081309

1310+
self.preferredURLPatterns = self.pilotJSON.get("PreferredURLPatterns", self.preferredURLPatterns)
1311+
13091312
# version(a comma separated values in a string). We take the first one. (the default value defined in the code)
13101313
dVersion = pilotOptions.get("Version", self.releaseVersion)
13111314
if dVersion:

Pilot/tests/Test_simplePilotLogger.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,6 @@ def test_executeAndGetOutput(self, popenMock, argvmock):
172172
self.stdout_mock.truncate()
173173
self.stderr_mock.truncate()
174174

175+
175176
if __name__ == "__main__":
176177
unittest.main()

0 commit comments

Comments
 (0)