Browse Source

ffpb_findnode: give correctly structured response in all cases

Helge Jung 9 years ago
parent
commit
c06dcb7c75
1 changed files with 5 additions and 15 deletions
  1. 5 15
      modules/ffpb.py

+ 5 - 15
modules/ffpb.py

@@ -396,20 +396,15 @@ def ffpb_findnode(name, allow_fuzzymatching=True):
         node = __batcave.find_node_by_mac(mac)
 
         if node is not None:
-            return node
+            return __batcave.get_node(node['id'])
 
         else:
             nodeid = mac.replace(':', '').lower()
             return {
                 'node_id': nodeid,
                 'hostname': '?-' + nodeid,
-                'network': {
-                    'addresses': [mac2ipv6(mac, 'fdca:ffee:ff12:132:')],
-                    'mac': mac,
-                },
-                'hardware': {
-                    'model': 'derived-from-mac',
-                },
+                'mac': mac,
+                'hardware': 'derived-from-mac',
             }
 
     # try to find by NAME
@@ -440,13 +435,8 @@ def ffpb_findnode(name, allow_fuzzymatching=True):
             return {
                 'node_id': peer_mac.replace(':', ''),
                 'hostname': peer_name,
-                'network': {
-                    'addresses': [mac2ipv6(peer_mac, 'fdca:ffee:ff12:132:'), ],
-                    'mac': peer_mac,
-                },
-                'hardware': {
-                    'model': 'derived-from-vpnkeys',
-                },
+                'mac': peer_mac,
+                'hardware': 'derived-from-vpnkeys',
             }
 
     # none of the above was able to identify the requested node