From 8ad90b425370b4f690512fb1c08ba3b26e4dbf12 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Mon, 31 Aug 2020 17:14:26 -0400 Subject: [PATCH] fix params for Agent.Host client RPC (#8795) The parameters for the receiving side of the Agent.Host client RPC did not take the arguments serialized at the server side. This results in a panic. --- client/agent_endpoint.go | 2 +- client/agent_endpoint_test.go | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client/agent_endpoint.go b/client/agent_endpoint.go index 8f6d3bf4b..481b1ecbc 100644 --- a/client/agent_endpoint.go +++ b/client/agent_endpoint.go @@ -213,7 +213,7 @@ OUTER: } // Host collects data about the host evironment running the agent -func (a *Agent) Host(args *structs.QueryOptions, reply *structs.HostDataResponse) error { +func (a *Agent) Host(args *structs.HostDataRequest, reply *structs.HostDataResponse) error { aclObj, err := a.c.ResolveToken(args.AuthToken) if err != nil { return err diff --git a/client/agent_endpoint_test.go b/client/agent_endpoint_test.go index 507ad42c2..0c10b4ebb 100644 --- a/client/agent_endpoint_test.go +++ b/client/agent_endpoint_test.go @@ -369,7 +369,7 @@ func TestAgentHost(t *testing.T) { }) defer cleanupC() - req := structs.QueryOptions{} + req := structs.HostDataRequest{} var resp structs.HostDataResponse err := c.ClientRPC("Agent.Host", &req, &resp) @@ -420,8 +420,10 @@ func TestAgentHost_ACL(t *testing.T) { for _, tc := range cases { t.Run(tc.Name, func(t *testing.T) { - req := structs.QueryOptions{ - AuthToken: tc.Token, + req := structs.HostDataRequest{ + QueryOptions: structs.QueryOptions{ + AuthToken: tc.Token, + }, } var resp structs.HostDataResponse