agent: don't reload scada client if there is no config change
This commit is contained in:
parent
8eea77d58f
commit
33cadcf925
|
@ -906,10 +906,13 @@ func (c *Command) handleReload(config *Config) *Config {
|
|||
}(wp)
|
||||
}
|
||||
|
||||
// Reload SCADA client
|
||||
if err := c.setupScadaConn(newConf); err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Failed reloading SCADA client: %s", err))
|
||||
return nil
|
||||
// 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
|
||||
|
|
|
@ -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" {
|
||||
|
|
Loading…
Reference in a new issue