diff --git a/command/agent/command.go b/command/agent/command.go index f6d8ac6337..e7c5d2641f 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -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 diff --git a/command/agent/command_test.go b/command/agent/command_test.go index 2b8a027f43..9839446981 100644 --- a/command/agent/command_test.go +++ b/command/agent/command_test.go @@ -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" {