From 26bdef9f50edcb0e4f22e39d2d8736644b6d6a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 28 Jul 2015 22:20:10 +0200 Subject: Ignore any exception raised while parsing output of boot output Any exception raised from user script, that should parse boot command output, should be ignored. If fails, no value is written to database. --- scripts/boot.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/boot.py b/scripts/boot.py index dd40b35..7ae30a9 100644 --- a/scripts/boot.py +++ b/scripts/boot.py @@ -26,12 +26,17 @@ def boot(config, to_database = True): f.write(line) # Let user script parse double value - out = utils.callsubprocess('parse_command', conf.parse_command, - conf.parse_output, True) - value = float(out[0]) + + value = None + try: + out = utils.callsubprocess('parse_command', conf.parse_command, + conf.parse_output, True) + value = float(out[0]) + except Exception as e: + print("W: parse exception: " + e.__str__()) if to_database: - dtb = database.database() - dtb.add_measure(config.cfile, config.id, value) + dtb = database.database() + dtb.add_measure(config.cfile, config.id, value) return config.cfile -- cgit v1.2.3