Fix Bug #1
This commit is contained in:
pucherot
2021-01-11 14:16:22 +01:00
parent 5711d11c4b
commit e94f8f8965
9 changed files with 27 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
VERSION = '2.50'
VERSION_YEAR = '2020'
VERSION_DATE = '2020-12-30'
VERSION = '2.51'
VERSION_YEAR = '2021'
VERSION_DATE = '2021-01-11'
DB_PATH = '/home/pi/pialert/db/pialert.db'
LOG_PATH = '/home/pi/pialert/log'

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
# Pi.Alert v2.50 / 2020-12-30
# Pi.Alert v2.51 / 2021-01-11
# Puche 2020
# GNU GPLv3
@@ -486,10 +486,17 @@ def read_DHCP_leases ():
return
# Read DHCP Leases
with open(DHCP_LEASES) as f:
reader = csv.reader(f, delimiter=' ')
data = [(col1, col2, col3, col4, col5)
for col1, col2, col3, col4, col5 in reader]
# Bugfix #1 - dhcp.leases: lines with different number of columns (5 col)
data = []
with open(DHCP_LEASES, 'r') as f:
for line in f:
row = line.rstrip().split()
if len(row) == 5 :
data.append (row)
# with open(DHCP_LEASES) as f:
# reader = csv.reader(f, delimiter=' ')
# data = [(col1, col2, col3, col4, col5)
# for col1, col2, col3, col4, col5 in reader]
# Insert into PiAlert table
sql.execute ("DELETE FROM DHCP_Leases")