From cb0fd5371367475df9de145296391ae88e3c2b41 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 18:26:16 +0200 Subject: [PATCH 1/7] insert history flag for netIdent --- config/config.template.ini | 2 ++ plugins/MySQL/MySQL.py | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config/config.template.ini b/config/config.template.ini index 7a959f2..1a10636 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -128,6 +128,8 @@ ricd = Unwetter # RIC for net identification # Usually sent periodically, separated by comma netIdent_ric = 0174760, 1398098 +# you can hold one entry per netIdent_ric [0] or the whole history [1] +netIdent_history = 0 [Filters] diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index e9d3d7e..e50d719 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -111,10 +111,13 @@ def run(typ,freq,data): elif typ == "POC": if isSignal(data["ric"]): - cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = '"+data["ric"]+"';") - if cursor.rowcount == 0: - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") - else: + if globalVars.config.getint("POC","netIdent_histry"): + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") + else: + cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = '"+data["ric"]+"';") + if cursor.rowcount == 0: + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") + else: cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"])) else: From 0f13853cc8babdc41c77c3872c6bf91a618090c7 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 18:28:27 +0200 Subject: [PATCH 2/7] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3f07e2..31653e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### __[v2.2.2]__ - unreleased ##### Added - Installations Script für Services [#316](https://github.com/Schrolli91/BOSWatch/pull/316) +- Flag in Config um nur letzte Net Ident oder gesamte Historie zu speichern [#317](https://github.com/Schrolli91/BOSWatch/pull/317) ##### Changed - Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315) - Versions Nummer und Branch Name getrennt [3fed1ac](https://github.com/Schrolli91/BOSWatch/commit/3fed1ac12af8690213766e0e81d71c237530ed2c) From a74ef0fe451c17f1fe8acd22f71ef2d4eb10fc6a Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 18:37:09 +0200 Subject: [PATCH 3/7] fix indentation level --- plugins/MySQL/MySQL.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index e50d719..0b8b2aa 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -110,14 +110,14 @@ def run(typ,freq,data): cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableZVEI")+" (time, zvei, description) VALUES (FROM_UNIXTIME(%s),%s,%s)", (data["timestamp"], data["zvei"], data["description"])) elif typ == "POC": - if isSignal(data["ric"]): + if isSignal(data["ric"]): if globalVars.config.getint("POC","netIdent_histry"): cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") else: cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = '"+data["ric"]+"';") if cursor.rowcount == 0: cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") - else: + else: cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"])) else: From cea266709cc721c5aa8dd52aa11711d8003981cf Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 18:39:18 +0200 Subject: [PATCH 4/7] fix indentation level --- plugins/MySQL/MySQL.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index 0b8b2aa..2c222b0 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -109,19 +109,19 @@ def run(typ,freq,data): elif typ == "ZVEI": cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableZVEI")+" (time, zvei, description) VALUES (FROM_UNIXTIME(%s),%s,%s)", (data["timestamp"], data["zvei"], data["description"])) - elif typ == "POC": + elif typ == "POC": if isSignal(data["ric"]): if globalVars.config.getint("POC","netIdent_histry"): cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") else: - cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = '"+data["ric"]+"';") - if cursor.rowcount == 0: - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") + cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = '"+data["ric"]+"';") + if cursor.rowcount == 0: + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") else: - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"])) + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"])) - else: - logging.warning("Invalid Typ: %s", typ) + else: + logging.warning("Invalid Typ: %s", typ) except: logging.error("cannot Insert %s", typ) logging.debug("cannot Insert %s", typ, exc_info=True) From de6073e8f61942178f771b00750cecb3452d2a82 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 18:42:38 +0200 Subject: [PATCH 5/7] fix indentation level --- plugins/MySQL/MySQL.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index 2c222b0..fd9f603 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -109,19 +109,19 @@ def run(typ,freq,data): elif typ == "ZVEI": cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableZVEI")+" (time, zvei, description) VALUES (FROM_UNIXTIME(%s),%s,%s)", (data["timestamp"], data["zvei"], data["description"])) - elif typ == "POC": - if isSignal(data["ric"]): - if globalVars.config.getint("POC","netIdent_histry"): - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") - else: - cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = '"+data["ric"]+"';") - if cursor.rowcount == 0: - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") - else: - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"])) + elif typ == "POC": + if isSignal(data["ric"]): + if globalVars.config.getint("POC","netIdent_histry"): + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") + else: + cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = '"+data["ric"]+"';") + if cursor.rowcount == 0: + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") + else: + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"])) - else: - logging.warning("Invalid Typ: %s", typ) + else: + logging.warning("Invalid Typ: %s", typ) except: logging.error("cannot Insert %s", typ) logging.debug("cannot Insert %s", typ, exc_info=True) From 5b9c8d75d9d083b6d87b679c64ecfeedb3326cb2 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 19:20:38 +0200 Subject: [PATCH 6/7] fix indentation level --- plugins/MySQL/MySQL.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index fd9f603..3d4db16 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -21,23 +21,23 @@ from includes import globalVars # Global variables from includes.helper import configHandler def isSignal(poc_id): - """ - @type poc_id: string - @param poc_id: POCSAG Ric + """ + @type poc_id: string + @param poc_id: POCSAG Ric - @requires: Configuration has to be set in the config.ini + @requires: Configuration has to be set in the config.ini - @return: True if the Ric is Signal, other False - @exception: none - """ - # If RIC is Signal return True, else False - if globalVars.config.get("POC", "netIdent_ric"): - if poc_id in globalVars.config.get("POC", "netIdent_ric"): - logging.info("RIC %s is net ident", poc_id) - return True - else: - logging.info("RIC %s is no net ident", poc_id) - return False + @return: True if the Ric is Signal, other False + @exception: none + """ + # If RIC is Signal return True, else False + if globalVars.config.get("POC", "netIdent_ric"): + if poc_id in globalVars.config.get("POC", "netIdent_ric"): + logging.info("RIC %s is net ident", poc_id) + return True + else: + logging.info("RIC %s is no net ident", poc_id) + return False ## From 50a2c70408df5437ae727b31fdb2fc8547d61965 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:55:46 +0200 Subject: [PATCH 7/7] edit CL --- CHANGELOG.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31653e9..fc0b047 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,28 @@ # Changelog -### __[v2.2.2]__ - unreleased + +### __[2.x]__ - unreleased +##### Added +- Flag in Config um nur letzte Net Ident oder gesamte Historie zu speichern [#317](https://github.com/Schrolli91/BOSWatch/pull/317) +##### Changed +##### Deprecated +##### Removed +##### Fixed +##### Security + + +### __[v2.2.2]__ - 21.10.2017 ##### Added - Installations Script für Services [#316](https://github.com/Schrolli91/BOSWatch/pull/316) -- Flag in Config um nur letzte Net Ident oder gesamte Historie zu speichern [#317](https://github.com/Schrolli91/BOSWatch/pull/317) ##### Changed - Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315) - Versions Nummer und Branch Name getrennt [3fed1ac](https://github.com/Schrolli91/BOSWatch/commit/3fed1ac12af8690213766e0e81d71c237530ed2c) ##### Deprecated -##### Removed +- Beta Branch wird mit nächstem Update entfernt [Forum](http://boswatch.de/index.php?thread/16-beta-branch-abschaffen/&postID=113#post113) ##### Fixed +- Schreibfehler der Pfadangabe im Installer [#317](https://github.com/Schrolli91/BOSWatch/pull/317) - Schreibfehler in Service Readme [#313](https://github.com/Schrolli91/BOSWatch/issues/313) - Einige Code-Style Verbesserungen [#310](https://github.com/Schrolli91/BOSWatch/pull/310) -##### Security ### __[v2.2.1]__ - 19.09.2017