diff --git a/boswatch/filter/doubeFilter.py b/boswatch/filter/doubeFilter.py index 066e18d..c230155 100644 --- a/boswatch/filter/doubeFilter.py +++ b/boswatch/filter/doubeFilter.py @@ -13,8 +13,7 @@ @date: 15.01.2018 @author: Bastian Schroll @description: Class to implement a filter for double alarms -@todo test, refactor and document -@todo check_msg is not implemented yet +@todo test, refactor and document / check_msg is not implemented yet """ import logging import time diff --git a/boswatch/network/server.py b/boswatch/network/server.py index e59c177..31a7e3c 100644 --- a/boswatch/network/server.py +++ b/boswatch/network/server.py @@ -140,9 +140,10 @@ class TCPServer: @staticmethod def getClientsConnected(): - """!List of currently connected Clients + """!A list of all connected clients + with their IP address and last seen timestamp _clients[ThreadName] = {"address", "timestamp"} - @return List of connected clients""" + @return List of onnected clients""" # todo return full list or write a print/debug method? return _clients diff --git a/boswatch/packet/packet.py b/boswatch/packet/packet.py index 801bc91..bf0103c 100644 --- a/boswatch/packet/packet.py +++ b/boswatch/packet/packet.py @@ -101,6 +101,5 @@ class Packet: """!Print a info message to the log on INFO level. Contains the most useful info about this packet. @todo not complete yet - must be edit to print nice formatted messages on console - - @param bwPacket: BOSWatch packet instance""" + """ logging.info("[%s]", self.get("mode")) diff --git a/boswatch/utils/paths.py b/boswatch/utils/paths.py index eac59b2..d3f00a7 100644 --- a/boswatch/utils/paths.py +++ b/boswatch/utils/paths.py @@ -17,13 +17,23 @@ import logging import os import sys +import platform logging.debug("- %s loaded", __name__) -# todo searching for root part is not a nice solution atm +# note searching for root part is not a nice solution atm ROOT_PATH = os.path.dirname(sys.modules['boswatch'].__file__).replace("\\", "/") + "/../" -LOG_PATH = ROOT_PATH + "log/" -CONFIG_PATH = ROOT_PATH + "config/" + +# implements a system adaption for the paths +if platform.system() == "Linux": + LOG_PATH = "/var/log/boswatch/" + CONFIG_PATH = "/etc/opt/boswatch/" +else: + # FIXME LOG_PATH not used actually + # path is fixed in logger config.ini + LOG_PATH = ROOT_PATH + "log/" + CONFIG_PATH = ROOT_PATH + "config/" + PLUGIN_PATH = ROOT_PATH + "plugins/" CSV_PATH = ROOT_PATH + "csv/" BIN_PATH = ROOT_PATH + "_bin/" diff --git a/boswatch/utils/wildcard.py b/boswatch/utils/wildcard.py index 636b27c..dc0f746 100644 --- a/boswatch/utils/wildcard.py +++ b/boswatch/utils/wildcard.py @@ -13,7 +13,6 @@ @date: 15.01.2018 @author: Bastian Schroll @description: Little Helper to replace wildcards in stings -@todo not completed yet """ import logging import time diff --git a/bw_client.py b/bw_client.py index 05d3873..4cb4d56 100644 --- a/bw_client.py +++ b/bw_client.py @@ -91,8 +91,7 @@ try: bwPacket.addClientData() bwClient.transmit(str(bwPacket)) - # todo should we do this in an thread, to not block receiving ??? - # todo but then we should use transmit() and receive() with Lock() + # todo should we do this in an thread, to not block receiving ??? but then we should use transmit() and receive() with Lock() failedTransmits = 0 while not bwClient.receive() == "[ack]": # wait for ack or timeout if failedTransmits >= 3: diff --git a/test/test_ServerClient.py b/test/test_ServerClient.py index 6e59d7f..fcba7a7 100644 --- a/test/test_ServerClient.py +++ b/test/test_ServerClient.py @@ -14,10 +14,10 @@ @author: Bastian Schroll @description: Unittests for BOSWatch. File must be _run as "pytest" unittest """ -import pytest import logging import time import queue +import pytest from boswatch.network.server import TCPServer from boswatch.network.client import TCPClient diff --git a/test/test_packet.py b/test/test_packet.py index f311a22..77fef07 100644 --- a/test/test_packet.py +++ b/test/test_packet.py @@ -14,8 +14,8 @@ @author: Bastian Schroll @description: Unittests for BOSWatch. File must be _run as "pytest" unittest """ -import pytest import logging +import pytest from boswatch.packet.packet import Packet