From 0d7f2e157aef0a7c4a112953373a04927c63d33b Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sat, 12 Dec 2020 10:02:11 +0100 Subject: [PATCH] Update Download Debug package - include config - bugfix for stream logger --- cps/config_sql.py | 8 ++++++++ cps/debug_info.py | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/cps/config_sql.py b/cps/config_sql.py index a17622eb..b1e487f9 100644 --- a/cps/config_sql.py +++ b/cps/config_sql.py @@ -272,6 +272,14 @@ class _ConfigSQL(object): setattr(self, field, new_value) return True + def toDict(self): + storage = {} + for k, v in self.__dict__.items(): + if k[0] != '_' or k.endswith("password"): + storage[k] = v + return storage + + def load(self): '''Load all configuration values from the underlying storage.''' s = self._read_from_storage() # type: _Settings diff --git a/cps/debug_info.py b/cps/debug_info.py index 75ef3bb8..aae97001 100644 --- a/cps/debug_info.py +++ b/cps/debug_info.py @@ -44,8 +44,12 @@ def assemble_logfiles(file_name): def send_debug(): file_list = glob.glob(logger.get_logfile(config.config_logfile) + '*') file_list.extend(glob.glob(logger.get_accesslogfile(config.config_access_logfile) + '*')) + for element in [logger.LOG_TO_STDOUT, logger.LOG_TO_STDERR]: + if element in file_list: + file_list.remove(element) memory_zip = io.BytesIO() with zipfile.ZipFile(memory_zip, 'w', compression=zipfile.ZIP_DEFLATED) as zf: + zf.writestr('settings.txt', json.dumps(config.toDict())) zf.writestr('libs.txt', json.dumps(collect_stats())) for fp in file_list: zf.write(fp, os.path.basename(fp))