Skip to content

Commit

Permalink
chore: handle user/pass slightly differently
Browse files Browse the repository at this point in the history
  • Loading branch information
DStrand1 committed Feb 8, 2024
1 parent 4035591 commit 819901c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugins/inputs/redfish/redfish.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 819901c

Please sign in to comment.