Get chipset value only if XML key exists
This commit is contained in:
parent
da42ef018c
commit
d940526f79
|
@ -251,7 +251,6 @@ def parse_nodewatcher_xml(xml):
|
|||
or len(tree.xpath("/data/interface_data/%s" % CONFIG["vpn_netif_aux"])) > 0),
|
||||
},
|
||||
"hardware": {
|
||||
#"name": tree.xpath("/data/system_data/model/text()")[0],
|
||||
"cpu": tree.xpath("/data/system_data/cpu/text()")[0]
|
||||
},
|
||||
"software": {
|
||||
|
@ -276,6 +275,11 @@ def parse_nodewatcher_xml(xml):
|
|||
router_update["hardware"]["name"] = "Legacy"
|
||||
router_update["hardware"]["name"] = tree.xpath("/data/system_data/model/text()")[0]
|
||||
|
||||
# data.system_data.chipset
|
||||
with suppress(IndexError):
|
||||
router_update["hardware"]["chipset"] = "Unknown"
|
||||
router_update["hardware"]["chipset"] = tree.xpath("/data/system_data/chipset/text()")[0]
|
||||
|
||||
# data.system_data.description
|
||||
with suppress(IndexError):
|
||||
router_update["description"] = tree.xpath("/data/system_data/description/text()")[0]
|
||||
|
|
Loading…
Reference in New Issue