little fix if no config is available

This commit is contained in:
Bastian Schroll 2019-03-09 12:19:09 +01:00
parent 2e9681b7d4
commit 58214fe7f1
3 changed files with 5 additions and 4 deletions

View file

@ -29,10 +29,11 @@ class BoswatchModule(Module):
"""!Filter of specific bwPacket mode"""
def __init__(self, config):
"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config DICT by 'self._config'
super().__init__(__name__, config) # you can access the config class on 'self.config'
def onLoad(self):
"""!Called by import of the plugin"""
print(self.config)
pass
def doWork(self, bwPacket):
@ -41,7 +42,7 @@ class BoswatchModule(Module):
@param bwPacket: A BOSWatch packet instance
@return bwPacket or False"""
for mode in self.config.get("allowed"):
for mode in self.config.get("allowed", default=[]):
if bwPacket.get("mode") == mode:
logging.debug("mode is allowed: %s", bwPacket.get("mode"))
return None

View file

@ -29,7 +29,7 @@ class BoswatchModule(Module):
"""!Description of the Module"""
def __init__(self, config):
"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config DICT by 'self._config'
super().__init__(__name__, config) # you can access the config class on 'self.config'
def onLoad(self):
"""!Called by import of the plugin"""

View file

@ -29,7 +29,7 @@ class BoswatchPlugin(Plugin):
"""!Description of the Plugin"""
def __init__(self, config):
"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config DICT by 'self._config'
super().__init__(__name__, config) # you can access the config class on 'self.config'
def onLoad(self):
"""!Called by import of the plugin"""