From 819901c39984426f943c8154eb3858974ec88a40 Mon Sep 17 00:00:00 2001 From: Dane Strandboge <136023093+DStrand1@users.noreply.github.com> Date: Thu, 8 Feb 2024 10:25:13 -0500 Subject: [PATCH] chore: handle user/pass slightly differently --- plugins/inputs/redfish/redfish.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/inputs/redfish/redfish.go b/plugins/inputs/redfish/redfish.go index e9f08db510668..008c0124854fe 100644 --- a/plugins/inputs/redfish/redfish.go +++ b/plugins/inputs/redfish/redfish.go @@ -225,15 +225,17 @@ func (r *Redfish) getData(address string, payload interface{}) error { if err != nil { return fmt.Errorf("getting username failed: %w", err) } - defer username.Destroy() + user := username.String() + username.Destroy() password, err := r.Password.Get() if err != nil { return fmt.Errorf("getting password failed: %w", err) } - defer password.Destroy() + pass := password.String() + password.Destroy() - req.SetBasicAuth(username.String(), password.String()) + req.SetBasicAuth(user, pass) req.Header.Set("Accept", "application/json") req.Header.Set("Content-Type", "application/json") req.Header.Set("OData-Version", "4.0")