diff --git a/ConfigurationSystem/Client/LocalConfiguration.py b/ConfigurationSystem/Client/LocalConfiguration.py index ed054518db9..a46f7ff5812 100755 --- a/ConfigurationSystem/Client/LocalConfiguration.py +++ b/ConfigurationSystem/Client/LocalConfiguration.py @@ -285,13 +285,17 @@ def __parseCommandLine(self): def __loadCFGFiles(self): """ - Load ~/.dirac.cfg - Load cfg files specified in addCFGFile calls - Load cfg files with come from the command line + Loads possibly several cfg files, in order: + 1. ~/.dirac.cfg + 2. cfg files pointed by DIRACSYSCONFIG env variable (comma-separated) + 3. cfg files specified in addCFGFile calls + 4. cfg files that come from the command line """ errorsList = [] if 'DIRACSYSCONFIG' in os.environ: - gConfigurationData.loadFile(os.environ['DIRACSYSCONFIG']) + diracSysConfigFiles = os.environ['DIRACSYSCONFIG'].replace(' ', '').split(',') + for diracSysConfigFile in reversed(diracSysConfigFiles): + gConfigurationData.loadFile(diracSysConfigFile) gConfigurationData.loadFile(os.path.expanduser("~/.dirac.cfg")) for fileName in self.additionalCFGFiles: gLogger.debug("Loading file %s" % fileName) diff --git a/Core/scripts/dirac-install.py b/Core/scripts/dirac-install.py index 44d7ede8c0a..346dc0d66d8 100755 --- a/Core/scripts/dirac-install.py +++ b/Core/scripts/dirac-install.py @@ -2188,7 +2188,9 @@ def createBashrc(): if cliParams.userEnvVariables: lines.extend(['# User-requested variables']) for envName, envValue in cliParams.userEnvVariables.items(): - lines.extend(['export %s=%s' % (envName, envValue)]) + lines.extend(['( echo $%s | grep -q $%s ) || export %s=$%s:$%s' % ( + envName, envValue, + envName, envName, envValue)]) lines.append('') f = open(bashrcFile, 'w') diff --git a/docs/source/AdministratorGuide/Configuration/ConfigurationStructure/index.rst b/docs/source/AdministratorGuide/Configuration/ConfigurationStructure/index.rst index c43fa6adf42..af35b2cec7b 100644 --- a/docs/source/AdministratorGuide/Configuration/ConfigurationStructure/index.rst +++ b/docs/source/AdministratorGuide/Configuration/ConfigurationStructure/index.rst @@ -69,7 +69,7 @@ in the order of preference of the option resolution: it will be interpreted as a configuration file, if the ``DIRAC_NO_CFG`` environment variable is not set. *Value of $DIRACSYSCONFIG environment variable* - if the DIRACSYSCONFIG variable is set, it should point to a cfg file (written in *CFG* format) + if the DIRACSYSCONFIG variable is set, it should point to a list of cfg file (written in *CFG* format), comma separated *$HOME/.dirac.cfg* This is the file in the user's home directory with the *CFG* format @@ -83,4 +83,4 @@ in the order of preference of the option resolution: The client needing a configuration option is first looking for it in the command line arguments. If the option is not found, the search continues in the user configuration file, then in the DIRAC installation configuration file and finally in the Configuration Service. These gives -a flexible mechanism of overriding global options by specific local settings. \ No newline at end of file +a flexible mechanism of overriding global options by specific local settings. diff --git a/docs/source/AdministratorGuide/ServerInstallations/environment_variable_configuration.rst b/docs/source/AdministratorGuide/ServerInstallations/environment_variable_configuration.rst index 8dcf3e3daf9..24b8fd3f0bc 100644 --- a/docs/source/AdministratorGuide/ServerInstallations/environment_variable_configuration.rst +++ b/docs/source/AdministratorGuide/ServerInstallations/environment_variable_configuration.rst @@ -35,7 +35,7 @@ DIRAC_VOMSES Can be set to point to a folder containing VOMSES information. See :ref:`multi_vo_dirac` DIRACSYSCONFIG - If set, its value should be (the full location on the file system of) a DIRAC cfg file, whose content will be used for the DIRAC configuration + If set, its value should be (the full locations on the file system of) one of more DIRAC cfg file(s) (comma separated), whose content will be used for the DIRAC configuration (see :ref:`dirac-cs-structure`) DISABLE_WATCHDOG_CPU_WALLCLOCK_CHECK