Skip to content

Commit

Permalink
Pass a nil config in case it isn't initialized
Browse files Browse the repository at this point in the history
Signed-off-by: Ben <[email protected]>
  • Loading branch information
Neon-White committed May 8, 2024
1 parent 7230414 commit f6d3295
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/obc/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,13 +566,14 @@ func (r *BucketRequest) CreateAccount() error {
defaultResource = r.BucketClass.Spec.PlacementPolicy.Tiers[0].BackingStores[0]
}

var nsfsAccountConfig nbv1.AccountNsfsConfig
var nsfsAccountConfig *nbv1.AccountNsfsConfig
// Validation is already performed as part of ValidateOBC before CreateAccount is ever called
// ...but we revalidate to satisfy the linter.
if r.OBC.Spec.AdditionalConfig["nsfsAccountConfig"] != "" {
err := json.Unmarshal([]byte(r.OBC.Spec.AdditionalConfig["nsfsAccountConfig"]), &nsfsAccountConfig)
nsfsAccountConfig = &nbv1.AccountNsfsConfig{}
err := json.Unmarshal([]byte(r.OBC.Spec.AdditionalConfig["nsfsAccountConfig"]), nsfsAccountConfig)
if err != nil {
return fmt.Errorf("failed to parse NSFS config %q: %v", r.OBC.Spec.AdditionalConfig["nsfsAccountConfig"], err)
return fmt.Errorf("failed to parse NSFS config %q: %w", r.OBC.Spec.AdditionalConfig["nsfsAccountConfig"], err)
}
}

Expand All @@ -584,7 +585,7 @@ func (r *BucketRequest) CreateAccount() error {
S3Access: true,
AllowBucketCreate: false,
BucketClaimOwner: r.BucketName,
NsfsAccountConfig: &nsfsAccountConfig,
NsfsAccountConfig: nsfsAccountConfig,
})
if err != nil {
return err
Expand Down

0 comments on commit f6d3295

Please sign in to comment.