alfred.py: pass firmware version to nodes.json

alfred-data
Nils Schneider 2014-02-02 23:28:09 +01:00
parent bd19e5f18c
commit 914836eb9a
4 changed files with 11 additions and 0 deletions

View File

@ -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:

View File

@ -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]

View File

@ -10,6 +10,7 @@ class Node():
"client": False
})
self.gps = None
self.firmware = None
def add_mac(self, mac):
mac = mac.lower()

View File

@ -185,6 +185,9 @@ class NodeDB:
if 'gps' in alias:
node.gps = alias['gps']
if 'firmware' in alias:
node.firmware = alias['firmware']
# list of macs
# if options['gateway']:
# mark_gateways(options['gateway'])