Alon Bar-Lev has uploaded a new change for review. Change subject: core: config: support multiple configurations ......................................................................
core: config: support multiple configurations Support multiple configurations by ':' separator. Support extra configuration to allow not overriding default. Change-Id: I2b1d2b41713e9ac4c27a32c4d3114d5c27106bb8 Signed-off-by: Alon Bar-Lev <[email protected]> --- M README.environment M src/otopi/constants.py M src/plugins/otopi/core/config.py 3 files changed, 26 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/66/11566/1 diff --git a/README.environment b/README.environment index cdb5057..08fe06a 100644 --- a/README.environment +++ b/README.environment @@ -56,7 +56,10 @@ Log file name. CORE/configFileName(str) [/etc/otopi.conf] - Configration file name. + Configration file names. ':' separated. + +CORE/configFileAppend(str) + Extra configuration to load. DIALOG/dialect(str) [human] Dialect to use. diff --git a/src/otopi/constants.py b/src/otopi/constants.py index dfe2e1c..00ba7c2 100644 --- a/src/otopi/constants.py +++ b/src/otopi/constants.py @@ -108,6 +108,7 @@ LOG_FILE_HANDLE = 'CORE/logFileHandle' LOG_REMOVE_AT_EXIT = 'CORE/logRemoveAtExit' CONFIG_FILE_NAME = 'CORE/configFileName' + CONFIG_FILE_APPEND = 'CORE/configFileAppend' @util.export diff --git a/src/plugins/otopi/core/config.py b/src/plugins/otopi/core/config.py index 9373c51..b33fc5c 100644 --- a/src/plugins/otopi/core/config.py +++ b/src/plugins/otopi/core/config.py @@ -95,20 +95,29 @@ ) ) ) + self.environment.setdefault( + constants.CoreEnv.CONFIG_FILE_APPEND, + None + ) configs = [] - configFile = self.resolveFile( - self.environment[constants.CoreEnv.CONFIG_FILE_NAME] - ) - configDir = '%s.d' % configFile - if os.path.exists(configFile): - configs.append(configFile) - if os.path.isdir(configDir): - configs += [ - os.path.join(configDir, f) - for f in sorted(os.listdir(configDir)) - if f.endswith('.conf') - ] + for f in ( + self.environment[constants.CoreEnv.CONFIG_FILE_NAME], + self.environment[constants.CoreEnv.CONFIG_FILE_APPEND], + ): + if f: + for c in f.split(':'): + configFile = self.resolveFile(c) + configDir = '%s.d' % configFile + if os.path.exists(configFile): + configs.append(configFile) + if os.path.isdir(configDir): + configs += [ + os.path.join(configDir, f) + for f in sorted(os.listdir(configDir)) + if f.endswith('.conf') + ] + self._configFiles = self._config.read(configs) self._readEnvironment( -- To view, visit http://gerrit.ovirt.org/11566 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2b1d2b41713e9ac4c27a32c4d3114d5c27106bb8 Gerrit-PatchSet: 1 Gerrit-Project: otopi Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
