summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go35
1 files changed, 29 insertions, 6 deletions
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)