try to fix zood update

This commit is contained in:
Jeff Carr 2025-03-06 07:50:01 -06:00
parent 76c5626d0a
commit 2a917124e2
2 changed files with 17 additions and 15 deletions

View File

@ -55,6 +55,7 @@ func handleMachine(r *http.Request, w http.ResponseWriter, hostname string, data
m.UserAgent = ua
}
if m.Upgrade {
log.Info(m.Hostname, "was told to upgrade zood")
fmt.Fprintln(w, "apt update")
m.Upgrade = false
} else {

View File

@ -44,9 +44,7 @@ func doMachinesUpgradeTable() {
// display the protobuf
me.zood.TB = AddMachinesPB(me.zood.box, me.machines)
f := func(m *zoopb.Machine) {
log.Info("upgrade machine", m.Hostname, "memory", m.Memory/(1024*1024*1024))
log.Info("ADD THE CODE TO TRIGGER AN UPGRADE HERE")
log.Info("ADD THE CODE TO TRIGGER AN UPGRADE HERE")
log.Info("Triggering machine", m.Hostname, "to upgrade zood")
m.Upgrade = true
}
me.zood.TB.Custom(f)
@ -58,6 +56,12 @@ func AddMachinesPB(tbox *gui.Node, pb *zoopb.Machines) *zoopb.MachinesTable {
t.NewUuid()
t.SetParent(tbox)
f := func(m *zoopb.Machine) string {
log.Info("machine =", m.Hostname)
return "now"
}
t.AddButtonFunc("upgrade", f)
t.AddHostname()
t.AddMemory()
t.AddCpus()
@ -69,23 +73,20 @@ func AddMachinesPB(tbox *gui.Node, pb *zoopb.Machines) *zoopb.MachinesTable {
return findVersion(m, "zood")
})
// show if the machine needs to be upgraded
t.AddStringFunc("triggered?", func(m *zoopb.Machine) string {
if m.Upgrade {
return "yes"
}
return ""
})
/*
// show if the machine needs to be upgraded
t.AddStringFunc("triggered?", func(m *zoopb.Machine) string {
if m.Upgrade {
return "yes"
}
return ""
})
*/
t.AddTimeFunc("age", func(m *zoopb.Machine) time.Time {
return m.Laststamp.AsTime()
})
f := func(m *zoopb.Machine) string {
log.Info("machine =", m.Hostname)
return m.Hostname
}
t.AddButtonFunc("upgrade", f)
t.ShowTable()
return t
}