Skip to content
Snippets Groups Projects
Commit fdd0bed5 authored by Leonard Penzer's avatar Leonard Penzer
Browse files

use raw.json instead of nodesdb.json

Migrate to raw.json from Yanic for upcoming Alfred shutdown
parent 615e679c
Branches
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ MAC_URL = 'http://macvendors.co/api/%s' ...@@ -12,6 +12,7 @@ MAC_URL = 'http://macvendors.co/api/%s'
def getHardwareModelFromEntry(d): def getHardwareModelFromEntry(d):
hardware_model = "UNKNOWN" hardware_model = "UNKNOWN"
if d != None: if d != None:
if "nodeinfo" in d:
if "hardware" in d: if "hardware" in d:
if "model" in d["hardware"]: if "model" in d["hardware"]:
hardware_model = d["hardware"]["model"] hardware_model = d["hardware"]["model"]
...@@ -104,11 +105,13 @@ for download in allFirmwareDownloads: ...@@ -104,11 +105,13 @@ for download in allFirmwareDownloads:
mac = ipv62mac(r.ipv6) mac = ipv62mac(r.ipv6)
if mac in data: nodes_with_mac = [node for node in data["nodes"] if node["nodeinfo"]["network"]["mac"] == mac]
d = data[mac]
currentRelease = d["software"]["firmware"]["release"] if len(nodes_with_mac) == 1:
status = d["status"] d = nodes_with_mac[0]
hostname = d["hostname"] currentRelease = d["nodeinfo"]["software"]["firmware"]["release"]
status = d["online"]
hostname = d["nodeinfo"]["hostname"]
hardware_model = getHardwareModelFromEntry(d) hardware_model = getHardwareModelFromEntry(d)
if currentRelease < r.release: if currentRelease < r.release:
print("%s (%s) %s -> %s Segment %i %s status %s @ %s" % (mac, hostname, currentRelease, r.release, r.segment, hardware_model, status, r.date)) print("%s (%s) %s -> %s Segment %i %s status %s @ %s" % (mac, hostname, currentRelease, r.release, r.segment, hardware_model, status, r.date))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment