From 77905e3f0b9c8fbcc0aeeabe066df4ec87cce7a9 Mon Sep 17 00:00:00 2001 From: Schrolli Date: Wed, 20 May 2015 09:38:30 +0200 Subject: [PATCH] change config reading in template plugin --- plugin_test/plugins/template/template.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/plugin_test/plugins/template/template.py b/plugin_test/plugins/template/template.py index 0cebb17..f5f370e 100644 --- a/plugin_test/plugins/template/template.py +++ b/plugin_test/plugins/template/template.py @@ -6,15 +6,14 @@ import globals # Global variables def run(typ,freq,data): try: - logging.debug("read config file") - data1 = globals.config.get("template", "data1") - data2 = globals.config.get("template", "data2") - data3 = globals.config.get("template", "data3") - data4 = globals.config.get("template", "data4") - logging.debug(" - Data1: %s", data1) - logging.debug(" - Data2: %s", data2) - logging.debug(" - Data3: %s", data3) - logging.debug(" - Data4: %s", data4) + #ConfigParser + logging.debug("reading config file") + try: + config = dict(globals.config.items("template")) + for key,val in config.items(): + logging.debug(" - %s = %s", key, val) + except: + logging.exception("cannot read config file") if typ == "FMS": logging.debug("FMS: %s Status: %s Dir: %s", data["fms"], data["status"], data["direction"])