diff --git a/command/agent/command.go b/command/agent/command.go index faecf04b24..6bd99aaf1d 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -466,7 +466,7 @@ func (c *Command) setupAgent(config *Config, logOutput io.Writer, logWriter *log c.agent = agent if config.Ports.HTTP > 0 || config.Ports.HTTPS > 0 { - servers, err := NewHTTPServers(agent, logOutput) + servers, err := NewHTTPServers(agent) if err != nil { agent.Shutdown() c.UI.Error(fmt.Sprintf("Error starting http servers: %s", err)) diff --git a/command/agent/http.go b/command/agent/http.go index 7d23416ca1..0cc6bde4e8 100644 --- a/command/agent/http.go +++ b/command/agent/http.go @@ -4,7 +4,6 @@ import ( "crypto/tls" "encoding/json" "fmt" - "io" "log" "net" "net/http" @@ -34,12 +33,9 @@ type HTTPServer struct { // NewHTTPServers starts new HTTP servers to provide an interface to // the agent. -func NewHTTPServers(agent *Agent, logOutput io.Writer) ([]*HTTPServer, error) { - if logOutput == nil { - return nil, fmt.Errorf("Please provide a valid logOutput(io.Writer)") - } - +func NewHTTPServers(agent *Agent) ([]*HTTPServer, error) { config := agent.config + logOutput := agent.logOutput var servers []*HTTPServer diff --git a/command/agent/http_test.go b/command/agent/http_test.go index 1d896c6788..9ff6fc3ed4 100644 --- a/command/agent/http_test.go +++ b/command/agent/http_test.go @@ -60,7 +60,7 @@ RECONF: } dir, agent := makeAgentLog(t, conf, l, logWriter) - servers, err := NewHTTPServers(agent, agent.logOutput) + servers, err := NewHTTPServers(agent) if err != nil { if configTry < 3 { goto RECONF @@ -160,7 +160,7 @@ func TestHTTPServer_UnixSocket_FileExists(t *testing.T) { defer os.RemoveAll(dir) // Try to start the server with the same path anyways. - if _, err := NewHTTPServers(agent, agent.logOutput); err != nil { + if _, err := NewHTTPServers(agent); err != nil { t.Fatalf("err: %s", err) } diff --git a/command/util_test.go b/command/util_test.go index 1f4b0e9018..b81282b460 100644 --- a/command/util_test.go +++ b/command/util_test.go @@ -78,7 +78,7 @@ func testAgentWithConfigReload(t *testing.T, cb func(c *agent.Config), reloadCh conf.Addresses.HTTP = "127.0.0.1" httpAddr := fmt.Sprintf("127.0.0.1:%d", conf.Ports.HTTP) - http, err := agent.NewHTTPServers(a, os.Stderr) + http, err := agent.NewHTTPServers(a) if err != nil { os.RemoveAll(dir) t.Fatalf(fmt.Sprintf("err: %v", err))