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

fix and simplify hardware model detection

parent fdd0bed5
No related branches found
No related tags found
No related merge requests found
...@@ -10,12 +10,11 @@ import requests ...@@ -10,12 +10,11 @@ import requests
MAC_URL = 'http://macvendors.co/api/%s' MAC_URL = 'http://macvendors.co/api/%s'
def getHardwareModelFromEntry(d): def getHardwareModelFromEntry(d):
try:
hardware_model = d["nodeinfo"]["hardware"]["model"]
except KeyError:
hardware_model = "UNKNOWN" hardware_model = "UNKNOWN"
if d != None:
if "nodeinfo" in d:
if "hardware" in d:
if "model" in d["hardware"]:
hardware_model = d["hardware"]["model"]
return hardware_model return hardware_model
def ipv62mac(ipv6): def ipv62mac(ipv6):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment