Index: /tools/check-batch-cmd
===================================================================
--- /tools/check-batch-cmd	(revision 10091)
+++ /tools/check-batch-cmd	(revision 10092)
@@ -41,16 +41,18 @@
   retval = sess.get(var_list)
   if sess.ErrorInd < 0:
-    raise CmdError('[%(ErrorInd)s] %(ErrorStr)s' % vars(sess))
+    raise CmdError('[%(ErrorInd)s] %(ErrorStr)s (%(DestHost)s)' % vars(sess))
   return filter(None, retval)[0]
 
 
 
-def main():
+def main(hostfilter=None):
   for host in gformat.get_hostlist():
+    if hostfilter and not hostfilter in host:
+      continue
     print "# Processing host", host
     datadump = gformat.get_yaml(host)
     for iface_key in datadump['autogen_iface_keys']:
       ifacedump = datadump[iface_key]
-      if ifacedump.has_key('ns_ip'):
+      if ifacedump.has_key('ns_ip') and ifacedump['ns_ip']:
         addr = ifacedump['ns_ip'].split('/')[0]
         print "## Bridge IP: %s" % addr
@@ -59,6 +61,6 @@
           bridge_type = get_bridge_type(addr)
           datadump[iface_key]['bridge_type'] = bridge_type
-        except (socket.timeout, socket.error):
-          print "### Conection failed"
+        except (socket.timeout, socket.error) as e:
+          print "### %s (%s)" % (e, addr)
         except paramiko.AuthenticationException:
           print "### Conection failed (invalid username/password)"
@@ -69,7 +71,6 @@
 
 if __name__ == '__main__':
-  if sys.argv[1:]:
-    for host in sys.argv[1:]:
-      print get_bridge_type(host)
+  if len(sys.argv) == 2:
+    main(hostfilter=sys.argv[1])
   else:
     main()
