Skip to content

Commit

Permalink
client: expose redfish etag match header disable parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
joelrebel committed Sep 25, 2023
1 parent fd15a4a commit cea5d31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ func WithRedfishUseBasicAuth(useBasicAuth bool) Option {
}
}

func WithRedfishEtagMatchDisabled(d bool) Option {
return func(args *Client) {
args.providerConfig.gofish.DisableEtagMatch = d
}
}

func WithIntelAMTHostScheme(hostScheme string) Option {
return func(args *Client) {
args.providerConfig.intelamt.HostScheme = hostScheme
Expand Down
8 changes: 4 additions & 4 deletions providers/redfish/redfish.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ type Config struct {
VersionsNotCompatible []string
RootCAs *x509.CertPool
UseBasicAuth bool
// WithEtagMatchDisabled disables the If-Match Etag header from being included by the Gofish driver.
disableEtagMatch bool
// DisableEtagMatch disables the If-Match Etag header from being included by the Gofish driver.
DisableEtagMatch bool
}

// Option for setting optional Client values
Expand Down Expand Up @@ -100,7 +100,7 @@ func WithUseBasicAuth(useBasicAuth bool) Option {
// As of the current implementation this disables the header for POST/PATCH requests to the System entity endpoints.
func WithEtagMatchDisabled(d bool) Option {
return func(c *Config) {
c.disableEtagMatch = d
c.DisableEtagMatch = d
}
}

Expand All @@ -118,7 +118,7 @@ func New(host, user, pass string, log logr.Logger, opts ...Option) *Conn {
rfOpts := []redfishwrapper.Option{
redfishwrapper.WithHTTPClient(defaultConfig.HttpClient),
redfishwrapper.WithVersionsNotCompatible(defaultConfig.VersionsNotCompatible),
redfishwrapper.WithEtagMatchDisabled(defaultConfig.disableEtagMatch),
redfishwrapper.WithEtagMatchDisabled(defaultConfig.DisableEtagMatch),
}

if defaultConfig.RootCAs != nil {
Expand Down

0 comments on commit cea5d31

Please sign in to comment.