mirror of
https://github.com/Oxalide/vsphere-influxdb-go.git
synced 2023-10-10 11:36:51 +00:00
Fail early
This commit is contained in:
parent
f4a61c416c
commit
6e2170f337
@ -706,7 +706,7 @@ func main() {
|
|||||||
file, err := os.Open(*cfgFile)
|
file, err := os.Open(*cfgFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errlog.Println("Could not open configuration file", *cfgFile)
|
errlog.Println("Could not open configuration file", *cfgFile)
|
||||||
errlog.Println(err)
|
errlog.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
jsondec := json.NewDecoder(file)
|
jsondec := json.NewDecoder(file)
|
||||||
@ -714,7 +714,7 @@ func main() {
|
|||||||
err = jsondec.Decode(&config)
|
err = jsondec.Decode(&config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errlog.Println("Could not decode configuration file", *cfgFile)
|
errlog.Println("Could not decode configuration file", *cfgFile)
|
||||||
errlog.Println(err)
|
errlog.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, vcenter := range config.VCenters {
|
for _, vcenter := range config.VCenters {
|
||||||
@ -728,10 +728,11 @@ func main() {
|
|||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errlog.Println("Could not connect to InfluxDB")
|
errlog.Println("Could not connect to InfluxDB")
|
||||||
errlog.Println(err)
|
errlog.Fatalln(err)
|
||||||
} else {
|
|
||||||
stdlog.Println("Successfully connected to Influx")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stdlog.Println("Successfully connected to Influx")
|
||||||
|
|
||||||
for _, vcenter := range config.VCenters {
|
for _, vcenter := range config.VCenters {
|
||||||
queryVCenter(*vcenter, config, InfluxDBClient)
|
queryVCenter(*vcenter, config, InfluxDBClient)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user