agent: don't reload scada client if there is no config change

This commit is contained in:
Ryan Uber 2015-08-25 20:43:57 -07:00
parent 8eea77d58f
commit 33cadcf925
2 changed files with 8 additions and 5 deletions

View File

@ -906,11 +906,14 @@ func (c *Command) handleReload(config *Config) *Config {
}(wp)
}
// Reload SCADA client
// Reload SCADA client if we have a change
if newConf.AtlasInfrastructure != config.AtlasInfrastructure ||
newConf.AtlasToken != config.AtlasToken {
if err := c.setupScadaConn(newConf); err != nil {
c.Ui.Error(fmt.Sprintf("Failed reloading SCADA client: %s", err))
return nil
}
}
return newConf
}

View File

@ -284,7 +284,7 @@ func TestSetupScadaConn(t *testing.T) {
t.Fatalf("err: %s", err)
}
if cmd.scadaHttp == http1 || cmd.scadaProvider == provider1 {
t.Fatalf("bad: %#v", cmd)
t.Fatalf("should change: %#v %#v", cmd.scadaHttp, cmd.scadaProvider)
}
list = cmd.scadaHttp.listener.(*scadaListener)
if list == nil || list.addr.infra != "hashicorp/test2" {