gwinfo: Delete IP addresses for old netif entries

This ensures that only the latest addresses are shown on the
gateway overview page.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2018-09-14 11:59:04 +02:00
parent b0165a4c9c
commit 7e34a20451
1 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,11 @@ def import_gw_data(mysql, gw_data):
SET stats_page = %s, last_contact = %s
WHERE id = %s
""",(gw_data["stats_page"],time,newid,))
mysql.execute("""
UPDATE gw_netif
SET ipv4 = NULL, ipv6 = NULL, dhcpstart = NULL, dhcpend = NULL
WHERE gw = %s
""",(newid,))
else:
mysql.execute("""
INSERT INTO gw (name, stats_page, last_contact)