aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNils Schneider <nils@nilsschneider.net>2014-02-02 23:28:09 +0100
committerNils Schneider <nils@nilsschneider.net>2014-02-02 23:30:16 +0100
commit914836eb9a777d0dbde7bf015b5715dad5fefb15 (patch)
treed6ac1cc40081429635f467b24eae5863430ba700
parentbd19e5f18ccefff3eee9fabe656956d3ece9adda (diff)
alfred.py: pass firmware version to nodes.json
-rwxr-xr-xalfred.py6
-rw-r--r--d3mapbuilder.py1
-rw-r--r--node.py1
-rw-r--r--nodedb.py3
4 files changed, 11 insertions, 0 deletions
diff --git a/alfred.py b/alfred.py
index c0f9d13..086ebc7 100755
--- a/alfred.py
+++ b/alfred.py
@@ -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:
diff --git a/d3mapbuilder.py b/d3mapbuilder.py
index 0d824be..3daf1ee 100644
--- a/d3mapbuilder.py
+++ b/d3mapbuilder.py
@@ -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]
diff --git a/node.py b/node.py
index bcd5cdd..ba0c3b0 100644
--- a/node.py
+++ b/node.py
@@ -10,6 +10,7 @@ class Node():
"client": False
})
self.gps = None
+ self.firmware = None
def add_mac(self, mac):
mac = mac.lower()
diff --git a/nodedb.py b/nodedb.py
index 6e77717..b6c2a76 100644
--- a/nodedb.py
+++ b/nodedb.py
@@ -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'])