cope with name changes
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# $Id: hbd,v 1.10 2006/04/28 12:23:59 andreas Exp $
|
# $Id: hbd,v 1.11 2006/04/28 12:53:08 andreas Exp $
|
||||||
# Wait for heartbeat messages and act on them (or their absence)
|
# Wait for heartbeat messages and act on them (or their absence)
|
||||||
#
|
#
|
||||||
import time, os, string, sys, socket, atexit, select, SocketServer, getopt
|
import time, os, string, sys, socket, atexit, select, SocketServer, getopt
|
||||||
@@ -252,6 +252,13 @@ def fromaddr(name, addr, boot, interval):
|
|||||||
if not htab.has_key(addr):
|
if not htab.has_key(addr):
|
||||||
addhost(name, addr)
|
addhost(name, addr)
|
||||||
host=hosts[htab[addr]]
|
host=hosts[htab[addr]]
|
||||||
|
if host.name != name:
|
||||||
|
log("%s changed name to %s" % (host.name, name))
|
||||||
|
del hosts[host.name]
|
||||||
|
host.name=name
|
||||||
|
hosts[name]=host
|
||||||
|
htab[addr]=name
|
||||||
|
|
||||||
host.lastbeat=now
|
host.lastbeat=now
|
||||||
if host.getstate() != Host.up and interval > 0:
|
if host.getstate() != Host.up and interval > 0:
|
||||||
lasts=host.state
|
lasts=host.state
|
||||||
|
|||||||
Reference in New Issue
Block a user