routertools/alfred: Set status earlier

This prevent a variable-not-found error when status is not set
in except statement.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2017-12-08 16:06:52 +01:00
parent 48bf9c008b
commit 7a678a73c6
1 changed files with 1 additions and 1 deletions

View File

@ -51,6 +51,7 @@ def import_nodewatcher_xml(mysql, mac, xml):
try:
findrouter = mysql.findone("SELECT router FROM router_netif WHERE mac = %s LIMIT 1",(mac.lower(),))
router_update = parse_nodewatcher_xml(xml)
status = router_update["status"]
if findrouter:
router_id = findrouter["router"]
olddata = mysql.findone("SELECT sys_uptime, firmware, hostname, hood, status, lat, lng, contact, description, position_comment FROM router WHERE id = %s LIMIT 1",(router_id,))
@ -157,7 +158,6 @@ def import_nodewatcher_xml(mysql, mac, xml):
if router_id:
new_router_stats(mysql, router_id, uptime, router_update)
status = router_update["status"]
except ValueError as e:
import traceback
print("Warning: Unable to parse xml from %s: %s\n__%s" % (mac, e, traceback.format_exc().replace("\n", "\n__")))