diff --git a/back/report_template.html b/back/report_template.html
index 962ff988..83809c3b 100755
--- a/back/report_template.html
+++ b/back/report_template.html
@@ -29,7 +29,7 @@
- | Report Date: |
+ Report Date: |
|
@@ -51,7 +51,7 @@
- |
+ |
Pi.Alert
()
©2020 Puche (2022+
diff --git a/back/report_template_new_version.html b/back/report_template_new_version.html
index b60ca231..06520878 100755
--- a/back/report_template_new_version.html
+++ b/back/report_template_new_version.html
@@ -29,7 +29,7 @@
|
- | Report Date: |
+ Report Date: |
|
@@ -51,7 +51,7 @@
- |
+ |
Pi.Alert
()
©2020 Puche (2022+
diff --git a/front/plugins/dhcp_leases/script.py b/front/plugins/dhcp_leases/script.py
index fc48678f..b1cbf76c 100755
--- a/front/plugins/dhcp_leases/script.py
+++ b/front/plugins/dhcp_leases/script.py
@@ -10,7 +10,7 @@ import sys
sys.path.append("/home/pi/pialert/front/plugins")
sys.path.append('/home/pi/pialert/pialert')
-from plugin_helper import Plugin_Object, Plugin_Objects
+from plugin_helper import Plugin_Object, Plugin_Objects, handleEmpty
from logger import mylog
from dhcp_leases import DhcpLeases
@@ -45,28 +45,28 @@ def get_entries(path, plugin_objects):
row = line.rstrip().split()
if len(row) == 5:
plugin_objects.add_object(
- primaryId=row[1],
- secondaryId=row[2],
- watched1='True',
- watched2=row[3],
- watched3=row[4],
- watched4='True',
- extra=path,
- foreignKey=row[1]
+ primaryId = handleEmpty(row[1]),
+ secondaryId = handleEmpty(row[2]),
+ watched1 = handleEmpty('True'),
+ watched2 = handleEmpty(row[3]),
+ watched3 = handleEmpty(row[4]),
+ watched4 = handleEmpty('True'),
+ extra = handleEmpty(path),
+ foreignKey = handleEmpty(row[1])
)
else:
leases = DhcpLeases(path)
leasesList = leases.get()
for lease in leasesList:
plugin_objects.add_object(
- primaryId=lease.ethernet,
- secondaryId=lease.ip,
- watched1=lease.active,
- watched2=lease.hostname,
- watched3=lease.hardware,
- watched4=lease.binding_state,
- extra=path,
- foreignKey=lease.ethernet
+ primaryId = handleEmpty(lease.ethernet),
+ secondaryId = handleEmpty(lease.ip),
+ watched1 = handleEmpty(lease.active),
+ watched2 = handleEmpty(lease.hostname),
+ watched3 = handleEmpty(lease.hardware),
+ watched4 = handleEmpty(lease.binding_state),
+ extra = handleEmpty(path),
+ foreignKey = handleEmpty(lease.ethernet)
)
return plugin_objects
diff --git a/front/plugins/plugin_helper.py b/front/plugins/plugin_helper.py
index 2b28b2e9..610f5a5e 100755
--- a/front/plugins/plugin_helper.py
+++ b/front/plugins/plugin_helper.py
@@ -33,6 +33,13 @@ pialertConfigFile = read_config_file()
timeZoneSetting = pialertConfigFile['TIMEZONE']
timeZone = pytz.timezone(timeZoneSetting)
+# -------------------------------------------------------------------
+def handleEmpty(input):
+ if input == '' or None:
+ return 'null'
+ else:
+ return input
+
# -------------------------------------------------------------------
def decodeBase64(inputParamBase64):
| | |