From 09b635219ac8d9b6d7a8a44eab44516cc1ebc9ee Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 23 Oct 2024 02:56:55 -0500 Subject: compiles and runs. logic wrong Signed-off-by: Jeff Carr --- main.go | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 48ab2c6..4456793 100644 --- a/main.go +++ b/main.go @@ -35,17 +35,40 @@ func main() { log.DaemonMode(true) } + // set defaults + me.unstable = time.Now() // initialize the grid as unstable + me.delay = 5 * time.Second // how often to poll the hypervisors + me.changed = false + cfgfile() + var ok bool = true for _, filename := range argv.Xml { log.Info("add xml file", filename) + domcfg, err := readXml(filename) + if err != nil { + log.Info("error:", filename, err) + ok = false + continue + } + d, err := addDroplet(domcfg) + if err != nil { + ok = false + } + if d == nil { + log.Info("addDroplet() returned nil") + ok = false + } + } + if me.changed { + writeConfigFile() + writeConfigFileDroplets() + os.Exit(0) + } + if !ok { + log.Info("adding xml files failed") + os.Exit(-1) } - - // initialize the grid as unstable - me.unstable = time.Now() - - // how often to poll the hypervisors - me.delay = 5 * time.Second /* log.Info("command line hypervisors:", argv.Hosts) -- cgit v1.2.3