Skip to content

Commit 2d03250

Browse files
authored
Merge pull request #7137 from DIRACGrid/fstagni-patch-1
[8.0] fix: look also for DIRAC.rootPath/etc/dirac.cfg
2 parents 26f2f23 + 1f2eeb6 commit 2d03250

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/DIRAC/ConfigurationSystem/Client/LocalConfiguration.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ def disableParsingCommandLine(self):
6161
def __getAbsolutePath(self, optionPath):
6262
if optionPath[0] == "/":
6363
return optionPath
64-
else:
65-
return f"{self.currentSectionPath}/{optionPath}"
64+
return f"{self.currentSectionPath}/{optionPath}"
6665

6766
def addMandatoryEntry(self, optionPath):
6867
"""
@@ -446,8 +445,9 @@ def __loadCFGFiles(self):
446445
Loads possibly several cfg files, in order:
447446
1. cfg files pointed by DIRACSYSCONFIG env variable (comma-separated)
448447
2. ~/.dirac.cfg
449-
3. cfg files specified in addCFGFile calls
450-
4. cfg files that come from the command line
448+
3. DIRAC.rootPath/etc/dirac.cfg
449+
4. cfg files specified in addCFGFile calls
450+
5. cfg files that come from the command line
451451
"""
452452
errorsList = []
453453
foundCFGFile = False
@@ -466,7 +466,11 @@ def __loadCFGFiles(self):
466466
foundCFGFile = True
467467
gConfigurationData.loadFile(os.path.expanduser("~/.dirac.cfg"))
468468

469-
# 3. cfg files specified in addCFGFile calls
469+
# 3. defaultCFGFile = os.path.join(DIRAC.rootPath, "etc", "dirac.cfg")
470+
if os.path.isfile(os.path.join(DIRAC.rootPath, "etc", "dirac.cfg")):
471+
foundCFGFile = True
472+
473+
# 4. cfg files specified in addCFGFile calls
470474
for fileName in self.additionalCFGFiles:
471475
if os.path.isfile(fileName):
472476
foundCFGFile = True
@@ -476,7 +480,7 @@ def __loadCFGFiles(self):
476480
gLogger.debug(f"Could not load file {fileName}: {retVal['Message']}")
477481
errorsList.append(retVal["Message"])
478482

479-
# 4. cfg files that come from the command line
483+
# 5. cfg files that come from the command line
480484
for fileName in self.cliAdditionalCFGFiles:
481485
if os.path.isfile(fileName):
482486
foundCFGFile = True

0 commit comments

Comments
 (0)