Index: tools/gformat.py
===================================================================
--- tools/gformat.py	(revision 13325)
+++ tools/gformat.py	(revision 13327)
@@ -1043,29 +1043,37 @@
 """).render(datadump)
 
+
+  def make_table(table):
+      if not table:
+        return " - none\n"
+      else:
+        lines = ""
+        col_width = [max(len(x) for x in col) for col in zip(*table)]
+        for row in table:
+          lines += " - " + " || ".join("{:{}}".format(x, col_width[i]) for i, x in enumerate(row)) + "\n"
+        return lines
+
   (addrs_list, dhclient_if, extra_ouput) = make_interface_list(datadump)
-  # Just nasty hack to make the formatting looks nice
-  iface_len = max(map(len,addrs_list.keys()))
-  addr_len = max(map(len,[x[0] for x in [x[0] for x in addrs_list.values()]]))
+  table = []
   for iface,addrs in sorted(addrs_list.iteritems()):
     if iface in ['lo0']:
       continue
     for addr, comment in sorted(addrs,key=lambda x: parseaddr(x[0].split('/')[0])):
-      output += " - %s || %s || %s\n" % (iface.ljust(iface_len), addr.ljust(addr_len), comment)
-
+      table.append((iface, addr, comment))
+
+  output += make_table(table)
   output += '\n'
   output += """\
-Attached bridges:
+Attached devices:
 """
-  has_item = False
+  table = []
   for iface_key in datadump['autogen_iface_keys']:
     ifacedump = datadump[iface_key]
     if ifacedump.has_key('ns_ip'):
-      ifacedump['autogen_ns_ip'] = ifacedump['ns_ip'].split('/')[0]
-      has_item = True
-      ifacedump['autogen_protocol'] = 'https' if 'M' in ifacedump['bridge_type'] else 'http'
-      output += " - %(autogen_ifname)s || %(mode)s || %(autogen_protocol)s://%(autogen_ns_ip)s\n" % ifacedump
-  if not has_item:
-    output += " - none\n"
-
+      x_ip = ifacedump['ns_ip'].split('/')[0]
+      x_proto = 'https' if 'M' in ifacedump['bridge_type'] else 'http'
+      table.append((ifacedump['autogen_ifname'], ifacedump['mode'], "%s://%s" % (x_proto, x_ip)))
+
+  output += make_table(table)
   output += '\n'
   output += """\
@@ -1078,8 +1086,4 @@
       continue
 
-    # Some formatting quirks
-    iface_len = max(map(len,addrs_list.keys()))
-    addr_len = max(map(len,[x[0] for x in [x[0] for x in addrs_list.values()]]))
-
     for addr, comment in sorted(addrs,key=lambda x: parseaddr(x[0].split('/')[0])):
       if not addr.startswith('172.'):
@@ -1090,12 +1094,5 @@
           table.append((iface, neighbour[1]['ip'].split('/')[0], neighbour[0] + " (" + neighbour[1]['autogen_ifname'] + ")", neighbour[1]['comment']))
 
-  if not table:
-    # This should be considered very odd as it indicate no active connections to other nodes
-    output += " - none\n"
-  else:
-    col_width = [max(len(x) for x in col) for col in zip(*table)]
-    for row in table:
-      output += " - " + " || ".join("{:{}}".format(x, col_width[i]) for i, x in enumerate(row)) + "\n"
-
+  output += make_table(table)
 
   return output
@@ -1949,5 +1946,5 @@
         datadumps[datadump['autogen_realname']] = datadump
 
-      (poel, errors) = make_relations(datadumps)
+      (poel, errors) = make_relations()
       print "\n".join(["# WARNING: %s" % x for x in errors])
 
