Fail early

This commit is contained in:
ADO 2017-05-24 14:02:46 +02:00
parent f4a61c416c
commit 6e2170f337
1 changed files with 6 additions and 5 deletions

View File

@ -706,7 +706,7 @@ func main() {
file, err := os.Open(*cfgFile)
if err != nil {
errlog.Println("Could not open configuration file", *cfgFile)
errlog.Println(err)
errlog.Fatalln(err)
}
jsondec := json.NewDecoder(file)
@ -714,7 +714,7 @@ func main() {
err = jsondec.Decode(&config)
if err != nil {
errlog.Println("Could not decode configuration file", *cfgFile)
errlog.Println(err)
errlog.Fatalln(err)
}
for _, vcenter := range config.VCenters {
@ -728,10 +728,11 @@ func main() {
})
if err != nil {
errlog.Println("Could not connect to InfluxDB")
errlog.Println(err)
} else {
stdlog.Println("Successfully connected to Influx")
errlog.Fatalln(err)
}
stdlog.Println("Successfully connected to Influx")
for _, vcenter := range config.VCenters {
queryVCenter(*vcenter, config, InfluxDBClient)
}