code is better because of autogenpb

This commit is contained in:
Jeff Carr 2024-12-04 02:25:46 -06:00
parent 5d9eb5add6
commit 1abcc862fe
3 changed files with 10 additions and 10 deletions

View File

@ -77,10 +77,10 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
if route == "/list" {
log.HttpMode(w)
defer log.HttpMode(nil)
loop := me.machines.SortByName()
loop := me.machines.SortByHostname()
for loop.Scan() {
m := loop.Machine()
zood := m.FindPackageByName("zood")
m := loop.Next()
zood := m.Packages.FindByName("zood")
v := me.targets["zood"] // this is the target version
if zood == nil {
log.Info("machine", m.Hostname, "does not have zood installed")

View File

@ -11,7 +11,7 @@ func updateMachine(u *zoopb.Machine) string {
if u == nil {
return "nil"
}
m := me.machines.FindByName(u.Hostname)
m := me.machines.FindByHostname(u.Hostname)
if m == nil {
log.Info("adding new machine", u.Hostname)
me.machines.Append(u)
@ -38,7 +38,7 @@ func updateMachine(u *zoopb.Machine) string {
if u.Packages == nil {
u.Packages = new(zoopb.Packages)
}
if zood := m.FindPackageByName("zood"); zood != nil {
if zood := m.Packages.FindByName("zood"); zood != nil {
log.Log(INFO, m.Hostname, "has zood version", zood.Version)
}
@ -55,9 +55,9 @@ func updatePackages(m *zoopb.Machine, newp *zoopb.Packages) bool {
loop := newp.SortByName()
for loop.Scan() {
p := loop.Package()
p := loop.Next()
if p.Name == "zood" {
if pold := m.FindPackageByName("zood"); pold == nil {
if pold := m.Packages.FindByName("zood"); pold == nil {
changed = true
log.Log(ZOOD, "updatePackages() new package", p.Name , "version", p.Version, "machine", m.Hostname)
m.Packages.Append(p)

View File

@ -41,11 +41,11 @@ func NewWatchdog() {
case t := <-me.dog.C:
// log.Info("zookeeper Watchdog() ticked", me.hostname, "Current time: ", t)
var counter int
loop := me.machines.SortByName()
loop := me.machines.SortByHostname()
for loop.Scan() {
m := loop.Machine()
m := loop.Next()
counter += 1
zood := m.FindPackageByName("zood")
zood := m.Packages.FindByName("zood")
if zood == nil {
log.Info("machine", m.Hostname, "does not have zood installed")
} else {