works again. I fucking deleted the kuma check

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-26 09:33:31 -05:00
parent b4518e8b82
commit 161bfe395e
2 changed files with 15 additions and 18 deletions

View File

@ -144,7 +144,7 @@ func main() {
h.lastpoll = time.Now()
me.hmap[pbh] = h
// me.hypers = append(me.hypers, h)
me.hypers = append(me.hypers, h)
log.Log(EVENT, "config new hypervisors", h.pb.Hostname)
}

25
poll.go
View File

@ -39,36 +39,35 @@ func (h *HyperT) pollHypervisor() {
}
log.Log(INFO, "ALREADY RECORDED", d.Hostname)
// update the status to ON and the last polled value
// update the status to ON
d.CurrentState = pb.DropletState_ON
// set the LastPoll time to now
now := time.Now()
d.LastPoll = timestamppb.New(now)
var cur *HyperT
// cur := find(d.CurrentHypervisor)
if cur == nil {
if d.CurrentHypervisor == "" {
// this means the droplet was in the config file
// but this is the first time it's shown up as running
// this should mean a droplet is running where the config file says it probably should be running
if d.PreferredHypervisor == h.pb.Hostname {
log.Log(EVENT, "new droplet", d.Hostname, "(matches config hypervisor", h.pb.Hostname+")")
cur = h
log.Log(EVENT, "poll shows new droplet", d.Hostname, "(matches config hypervisor", h.pb.Hostname+")")
d.CurrentHypervisor = h.pb.Hostname
continue
}
log.Log(EVENT, "new droplet", d.Hostname, "on", h.pb.Hostname, "(in config file without preferred hypervisor)")
cur = h
log.Log(EVENT, "poll shows new droplet", d.Hostname, "on", h.pb.Hostname, "(in config file without preferred hypervisor)")
d.CurrentHypervisor = h.pb.Hostname
continue
}
// this means the droplet is still where it was before
if cur.pb.Hostname != h.pb.Hostname {
// this means the droplet has moved
if d.CurrentHypervisor != h.pb.Hostname {
log.Log(EVENT, "droplet", d.Hostname, "moved to", h.pb.Hostname)
continue
}
cur = h
d.CurrentHypervisor = h.pb.Hostname
}
continue
}
@ -77,13 +76,11 @@ func (h *HyperT) pollHypervisor() {
}
func findDroplet(name string) *pb.Droplet {
/*
for _, d := range me.droplets {
for _, d := range me.cluster.Droplets {
if d.Hostname == name {
return d
}
}
*/
return nil
}