try writing out events

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-25 07:24:41 -05:00
parent da2a24c549
commit 03eec14619
3 changed files with 21 additions and 2 deletions

View File

@ -112,11 +112,13 @@ func updateDroplet(d *DropletT, domcfg *libvirtxml.Domain) error {
// OS Type: &{Arch:x86_64 Machine:pc-i440fx-5.2 Type:hvm}
t := domcfg.OS.Type
if d.pb.QemuArch != t.Arch {
alle = append(alle, NewChangeEvent(d.pb, "Droplet.QemuArch", d.pb.QemuArch, t.Arch))
e := NewChangeEvent(d.pb, "Droplet.QemuArch", d.pb.QemuArch, t.Arch)
alle = append(alle, e)
d.pb.QemuArch = t.Arch
}
if d.pb.QemuMachine != t.Machine {
alle = append(alle, NewChangeEvent(d.pb, "Droplet.QemuMachine", d.pb.QemuMachine, t.Machine))
e := NewChangeEvent(d.pb, "Droplet.QemuMachine", d.pb.QemuMachine, t.Machine)
alle = append(alle, e)
d.pb.QemuMachine = t.Machine
}
}

View File

@ -69,6 +69,7 @@ func NewChangeEvent(d *pb.Droplet, fname string, origval any, newval any) *pb.Ev
e.Droplet = d.Hostname
e.OrigVal = convertToString(origval)
e.NewVal = convertToString(newval)
e.FieldName = fname
// this also works, but it's a bit overkill
// e.NewAny = convertToAnypb(newval)

View File

@ -120,6 +120,22 @@ func writeConfigFile() {
log.Println("config file write error")
os.Exit(-1)
}
if me.events.WriteConfigJSON() {
os.Exit(-1)
}
if me.events.WriteConfigTEXT() {
os.Exit(-1)
}
/*
if me.cluster.Droplets.WriteConfigJSON() {
os.Exit(-1)
}
if me.cluster.Droplets.WriteConfigTEXT() {
os.Exit(-1)
}
*/
}
func writeConfigFileTmp(filename string) bool {