From 1f2eeb62f4325838bb20f15490a97b4db9f72339 Mon Sep 17 00:00:00 2001 From: fstagni Date: Thu, 27 Jul 2023 15:18:31 +0200 Subject: [PATCH] fix: look also for DIRAC.rootPath/etc/dirac.cfg BEGINRELEASENOTES *Core FIX: look also for DIRAC.rootPath/etc/dirac.cfg before printing a warning of not found cfg ENDRELEASENOTES --- .../Client/LocalConfiguration.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/DIRAC/ConfigurationSystem/Client/LocalConfiguration.py b/src/DIRAC/ConfigurationSystem/Client/LocalConfiguration.py index 0f4c7e22de6..a7e19116184 100755 --- a/src/DIRAC/ConfigurationSystem/Client/LocalConfiguration.py +++ b/src/DIRAC/ConfigurationSystem/Client/LocalConfiguration.py @@ -61,8 +61,7 @@ def disableParsingCommandLine(self): def __getAbsolutePath(self, optionPath): if optionPath[0] == "/": return optionPath - else: - return f"{self.currentSectionPath}/{optionPath}" + return f"{self.currentSectionPath}/{optionPath}" def addMandatoryEntry(self, optionPath): """ @@ -446,8 +445,9 @@ def __loadCFGFiles(self): Loads possibly several cfg files, in order: 1. cfg files pointed by DIRACSYSCONFIG env variable (comma-separated) 2. ~/.dirac.cfg - 3. cfg files specified in addCFGFile calls - 4. cfg files that come from the command line + 3. DIRAC.rootPath/etc/dirac.cfg + 4. cfg files specified in addCFGFile calls + 5. cfg files that come from the command line """ errorsList = [] foundCFGFile = False @@ -466,7 +466,11 @@ def __loadCFGFiles(self): foundCFGFile = True gConfigurationData.loadFile(os.path.expanduser("~/.dirac.cfg")) - # 3. cfg files specified in addCFGFile calls + # 3. defaultCFGFile = os.path.join(DIRAC.rootPath, "etc", "dirac.cfg") + if os.path.isfile(os.path.join(DIRAC.rootPath, "etc", "dirac.cfg")): + foundCFGFile = True + + # 4. cfg files specified in addCFGFile calls for fileName in self.additionalCFGFiles: if os.path.isfile(fileName): foundCFGFile = True @@ -476,7 +480,7 @@ def __loadCFGFiles(self): gLogger.debug(f"Could not load file {fileName}: {retVal['Message']}") errorsList.append(retVal["Message"]) - # 4. cfg files that come from the command line + # 5. cfg files that come from the command line for fileName in self.cliAdditionalCFGFiles: if os.path.isfile(fileName): foundCFGFile = True