alfred.py: pass firmware version to nodes.json
parent
bd19e5f18c
commit
914836eb9a
|
@ -14,6 +14,12 @@ class alfred:
|
|||
node_alias = {}
|
||||
if 'location' in node:
|
||||
node_alias['gps'] = str(node['location']['latitude']) + ' ' + str(node['location']['longitude'])
|
||||
|
||||
try:
|
||||
node_alias['firmware'] = node['software']['firmware']['release']
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if 'hostname' in node:
|
||||
node_alias['name'] = node['hostname']
|
||||
elif 'name' in node:
|
||||
|
|
|
@ -15,6 +15,7 @@ class D3MapBuilder:
|
|||
output['nodes'] = [{'name': x.name, 'id': x.id,
|
||||
'macs': ', '.join(x.macs),
|
||||
'geo': [float(x) for x in x.gps.split(" ")] if x.gps else None,
|
||||
'firmware': x.firmware,
|
||||
'flags': x.flags
|
||||
} for x in nodes]
|
||||
|
||||
|
|
1
node.py
1
node.py
|
@ -10,6 +10,7 @@ class Node():
|
|||
"client": False
|
||||
})
|
||||
self.gps = None
|
||||
self.firmware = None
|
||||
|
||||
def add_mac(self, mac):
|
||||
mac = mac.lower()
|
||||
|
|
Loading…
Reference in New Issue