From ec5a51bebb4cabfca111eb345dcbbffbd07e9e50 Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 29 Jan 2020 19:42:02 +0100 Subject: [PATCH] core: log filenames of read config files --- sat/memory/memory.py | 2 +- sat/tools/config.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sat/memory/memory.py b/sat/memory/memory.py index 42fe2811..93d61096 100644 --- a/sat/memory/memory.py +++ b/sat/memory/memory.py @@ -237,7 +237,7 @@ class Memory(object): self.disco = Discovery(host) # XXX: tmp update code, will be removed in the future tools_config.fixLocalDir(False) - self.config = tools_config.parseMainConf() + self.config = tools_config.parseMainConf(log_filenames=True) database_file = os.path.expanduser( os.path.join(self.getConfig("", "local_dir"), C.SAVEFILE_DATABASE) ) diff --git a/sat/tools/config.py b/sat/tools/config.py index 9c3d7067..8cf886d2 100644 --- a/sat/tools/config.py +++ b/sat/tools/config.py @@ -99,13 +99,22 @@ def fixLocalDir(silent=True): fixConfigOption("", "local_dir", old_default, silent) -def parseMainConf(): - """look for main .ini configuration file, and parse it""" +def parseMainConf(log_filenames=False): + """Look for main .ini configuration file, and parse it + + @param log_filenames(bool): if True, log filenames of read config files + """ config = ConfigParser(defaults=C.DEFAULT_CONFIG) try: - config.read(C.CONFIG_FILES) + filenames = config.read(C.CONFIG_FILES) except Exception as e: log.error(_("Can't read main config: {msg}").format(msg=e), exc_info=True) + else: + if log_filenames: + log.info( + _("Configuration was read from: {filenames}").format( + filenames=', '.join(filenames))) + return config