diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -52,6 +52,7 @@ func main() { // sanity check the droplets checkDroplets() + // ok tracks if all the libvirt xml files imported ok var ok bool = true for _, filename := range argv.Xml { domcfg, err := readXml(filename) @@ -79,19 +80,18 @@ func main() { } } else { // this droplet is already here - if updateDroplet(d, domcfg) { - if me.changed { - log.Info("updateDroplet() worked. droplet changed") - } else { - log.Info(filename, "nothing changed") - } - } else { - log.Info("updateDroplet() failed for", d.pb.Hostname) + err := updateDroplet(d, domcfg) + if err != nil { + log.Info("updateDroplet() error", d.pb.Hostname, err) ok = false } } } if len(argv.Xml) != 0 { + if !ok { + log.Info("importing xml files had errors") + os.Exit(-1) + } if me.changed { if argv.Save { writeConfigFile() @@ -100,10 +100,6 @@ func main() { log.Info("Not saving changes (use --save to save)") } } - if !ok { - log.Info("adding xml files failed") - os.Exit(-1) - } os.Exit(0) } |
