Changeset 10092 in genesis
- Timestamp:
- Mar 10, 2012, 5:03:16 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/check-batch-cmd
r10089 r10092 41 41 retval = sess.get(var_list) 42 42 if sess.ErrorInd < 0: 43 raise CmdError('[%(ErrorInd)s] %(ErrorStr)s ' % vars(sess))43 raise CmdError('[%(ErrorInd)s] %(ErrorStr)s (%(DestHost)s)' % vars(sess)) 44 44 return filter(None, retval)[0] 45 45 46 46 47 47 48 def main( ):48 def main(hostfilter=None): 49 49 for host in gformat.get_hostlist(): 50 if hostfilter and not hostfilter in host: 51 continue 50 52 print "# Processing host", host 51 53 datadump = gformat.get_yaml(host) 52 54 for iface_key in datadump['autogen_iface_keys']: 53 55 ifacedump = datadump[iface_key] 54 if ifacedump.has_key('ns_ip') :56 if ifacedump.has_key('ns_ip') and ifacedump['ns_ip']: 55 57 addr = ifacedump['ns_ip'].split('/')[0] 56 58 print "## Bridge IP: %s" % addr … … 59 61 bridge_type = get_bridge_type(addr) 60 62 datadump[iface_key]['bridge_type'] = bridge_type 61 except (socket.timeout, socket.error) :62 print "### Conection failed"63 except (socket.timeout, socket.error) as e: 64 print "### %s (%s)" % (e, addr) 63 65 except paramiko.AuthenticationException: 64 66 print "### Conection failed (invalid username/password)" … … 69 71 70 72 if __name__ == '__main__': 71 if sys.argv[1:]: 72 for host in sys.argv[1:]: 73 print get_bridge_type(host) 73 if len(sys.argv) == 2: 74 main(hostfilter=sys.argv[1]) 74 75 else: 75 76 main()
Note:
See TracChangeset
for help on using the changeset viewer.