mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-02-03 22:04:18 +01:00
insert configHandler.checkConfig() helper in all plugins so save always same code
This commit is contained in:
parent
cbb9481c5c
commit
76686e016c
|
|
@ -19,6 +19,8 @@ import base64 #for the HTTP request with User/Password
|
|||
|
||||
from includes import globals # Global variables
|
||||
|
||||
from includes.helper import configHandler
|
||||
|
||||
##
|
||||
#
|
||||
# onLoad (init) function of plugin
|
||||
|
|
@ -98,17 +100,7 @@ def run(typ,freq,data):
|
|||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
#
|
||||
# ConfigParser
|
||||
#
|
||||
logging.debug("reading config file")
|
||||
try:
|
||||
for key,val in globals.config.items("BosMon"):
|
||||
logging.debug(" - %s = %s", key, val)
|
||||
except:
|
||||
logging.error("cannot read config file")
|
||||
logging.debug("cannot read config file", exc_info=True)
|
||||
else: # Without config, plugin couldn't work
|
||||
if configHandler.checkConfig("BosMon"): #read and debug the config
|
||||
|
||||
try:
|
||||
#
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ import mysql.connector
|
|||
|
||||
from includes import globals # Global variables
|
||||
|
||||
from includes.helper import configHandler
|
||||
|
||||
##
|
||||
#
|
||||
# onLoad (init) function of plugin
|
||||
|
|
@ -62,17 +64,7 @@ def run(typ,freq,data):
|
|||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
#
|
||||
#ConfigParser
|
||||
#
|
||||
logging.debug("reading config file")
|
||||
try:
|
||||
for key,val in globals.config.items("MySQL"):
|
||||
logging.debug(" - %s = %s", key, val)
|
||||
except:
|
||||
logging.error("cannot read config file")
|
||||
logging.debug("cannot read config file", exc_info=True)
|
||||
else: # Without config, plugin couldn't work
|
||||
if configHandler.checkConfig("MySQL"): #read and debug the config
|
||||
|
||||
try:
|
||||
#
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ from email.utils import formatdate # need for confirm to RFC2822 standard
|
|||
from email.utils import make_msgid # need for confirm to RFC2822 standard
|
||||
|
||||
from includes import globals # Global variables
|
||||
|
||||
from includes.helper import timeHandler # helper function
|
||||
from includes.helper import configHandler
|
||||
|
||||
##
|
||||
#
|
||||
|
|
@ -95,18 +97,7 @@ def run(typ,freq,data):
|
|||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
#
|
||||
# ConfigParser
|
||||
#
|
||||
logging.debug("reading config file")
|
||||
try:
|
||||
for key,val in globals.config.items("eMail"):
|
||||
logging.debug(" - %s = %s", key, val)
|
||||
|
||||
except:
|
||||
logging.error("cannot read config file")
|
||||
logging.debug("cannot read config file", exc_info=True)
|
||||
else: # Without config, plugin couldn't work
|
||||
if configHandler.checkConfig("eMail"): #read and debug the config
|
||||
|
||||
try:
|
||||
#
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ import socket
|
|||
|
||||
from includes import globals # Global variables
|
||||
|
||||
from includes.helper import configHandler
|
||||
|
||||
###
|
||||
#
|
||||
# onLoad (init) function of plugin
|
||||
|
|
@ -59,17 +61,7 @@ def run(typ,freq,data):
|
|||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
#
|
||||
#ConfigParser
|
||||
#
|
||||
logging.debug("reading config file")
|
||||
try:
|
||||
for key,val in globals.config.items("firEmergency"):
|
||||
logging.debug(" - %s = %s", key, val)
|
||||
except:
|
||||
logging.error("cannot read config file")
|
||||
logging.debug("cannot read config file", exc_info=True)
|
||||
else: # Without config, plugin couldn't work
|
||||
if configHandler.checkConfig("firEmergency"): #read and debug the config
|
||||
|
||||
try:
|
||||
#
|
||||
|
|
|
|||
|
|
@ -15,8 +15,10 @@ import httplib #for the HTTP request
|
|||
from urlparse import urlparse #for split the URL into url and path
|
||||
|
||||
from includes import globals # Global variables
|
||||
|
||||
from includes.helper import timeHandler
|
||||
from includes.helper import wildcardHandler
|
||||
from includes.helper import configHandler
|
||||
|
||||
##
|
||||
#
|
||||
|
|
@ -58,17 +60,7 @@ def run(typ,freq,data):
|
|||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
#
|
||||
# ConfigParser
|
||||
#
|
||||
logging.debug("reading config file")
|
||||
try:
|
||||
for key,val in globals.config.items("httpRequest"):
|
||||
logging.debug(" - %s = %s", key, val)
|
||||
except:
|
||||
logging.error("cannot read config file")
|
||||
logging.debug("cannot read config file", exc_info=True)
|
||||
else: # Without config, plugin couldn't work
|
||||
if configHandler.checkConfig("httpRequest"): #read and debug the config
|
||||
|
||||
try:
|
||||
#
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import json # for data-transfer
|
|||
|
||||
from includes import globals # Global variables
|
||||
|
||||
from includes.helper import configHandler
|
||||
|
||||
##
|
||||
#
|
||||
# onLoad (init) function of plugin
|
||||
|
|
@ -58,18 +60,7 @@ def run(typ,freq,data):
|
|||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
#
|
||||
# ConfigParser
|
||||
#
|
||||
logging.debug("reading config file")
|
||||
try:
|
||||
for key,val in globals.config.items("jsonSocket"):
|
||||
logging.debug(" - %s = %s", key, val)
|
||||
|
||||
except:
|
||||
logging.error("cannot read config file")
|
||||
logging.debug("cannot read config file", exc_info=True)
|
||||
else: # Without config, plugin couldn't work
|
||||
if configHandler.checkConfig("jsonSocket"): #read and debug the config
|
||||
|
||||
try:
|
||||
#
|
||||
|
|
|
|||
|
|
@ -73,9 +73,6 @@ def run(typ,freq,data):
|
|||
@exception: nothing, make sure this function will never thrown an exception
|
||||
"""
|
||||
try:
|
||||
#
|
||||
# ConfigParser
|
||||
#
|
||||
if configHandler.checkConfig("template"): #read and debug the config (let empty if no config used)
|
||||
|
||||
########## User Plugin CODE ##########
|
||||
|
|
|
|||
Loading…
Reference in a new issue