Browse Source

identify: make answers similar (always with hostname+id of node)

Helge Jung 9 years ago
parent
commit
69d98f0114
1 changed files with 8 additions and 4 deletions
  1. 8 4
      ffstatus/server.py

+ 8 - 4
ffstatus/server.py

@@ -457,12 +457,16 @@ angesprochen und sollte aus einer Mehrzahl von Gründen nicht
 
             for nodeid in nodes:
                 node = nodes[nodeid]
-                if ident == node.get('mac', '').lower() or \
-                   ident in [x.lower() for x in node.get('macs', [])]:
-                    answer.append('mac of node "%s" (id %s)' % (node.get('hostname', '?'), node.get('node_id')))
+                nodename = node.get('hostname', '?')
+                nodeinfo = 'node "%s" (id %s)' % (nodename, nodeid)
+
+                if ident == node.get('mac', '').lower():
+                    answer.append('primary mac of ' + nodeinfo)
+                elif ident in [x.lower() for x in node.get('macs', [])]:
+                    answer.append('mac of ' + nodeinfo)
 
                 if ident in [c.lower() for c in node.get('clients', [])]:
-                    answer.append('client at node "%s"' % node.get('hostname', '?'))
+                    answer.append('client at ' + nodeinfo)
 
         self.wfile.write(json.dumps(answers))