From 26fc2a9aef905b0ce32c8a93cc99a4fda15d597d Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Fri, 2 May 2014 10:49:01 +0200 Subject: [PATCH] alfred: use network.mac as ID if present --- alfred.py | 5 +++++ nodedb.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/alfred.py b/alfred.py index c92bc12..63296c9 100755 --- a/alfred.py +++ b/alfred.py @@ -23,6 +23,11 @@ class alfred: except KeyError: pass + try: + node_alias['id'] = node['network']['mac'] + except KeyError: + pass + if 'hostname' in node: node_alias['name'] = node['hostname'] elif 'name' in node: diff --git a/nodedb.py b/nodedb.py index 6a4726f..25c0e8c 100644 --- a/nodedb.py +++ b/nodedb.py @@ -191,6 +191,9 @@ class NodeDB: if 'firmware' in alias: node.firmware = alias['firmware'] + if 'id' in alias: + node.id = alias['id'] + # list of macs # if options['gateway']: # mark_gateways(options['gateway'])