diff --git a/RevidCLI.go b/RevidCLI.go index 8a58198b..e0af37eb 100644 --- a/RevidCLI.go +++ b/RevidCLI.go @@ -92,11 +92,10 @@ const ( // Globals var ( - configReceived bool = true - varSum int = 0 - vars = make(map[string]string) - revidInst revid.Revid - config revid.Config + varSum int = 0 + vars = make(map[string]string) + revidInst revid.Revid + config revid.Config ) func main() { @@ -278,32 +277,22 @@ func netsenderInit() { config.Logger = netsender.GetLogger() netsender.Init(false) netsender.ExternalReader = revidReportActions - - //try get initial config - if err := netsender.GetConfig(); err != nil { - //default to a config????? - config.Logger.Log("Error", err.Error()) - } else { - configReceived = true - } } //periodicNetsenderReport is called by the main function every monPeriod seconds. It makes sure a config has been recieved, and then //reports back CPU stats and updates vars func periodicNetsenderReport() { - if !configReceived { + if !netsender.IsConfigured() { if err := netsender.GetConfig(); err != nil { config.Logger.Log("Error", err.Error()) - } else { - configReceived = true } } inputs := netsender.SplitCSV(netsender.GetConfigParam("inputs")) if _, reconfig, err := netsender.Send(netsender.RequestPoll, inputs); err == nil && reconfig { - if err = netsender.GetConfig(); err != nil { - config.Logger.Log("Error", err.Error()) - } + if err = netsender.GetConfig(); err != nil { + config.Logger.Log("Error", err.Error()) + } } if cloudVarSum := netsender.GetVarSum(); cloudVarSum != varSum {