Skip to content

Commit

Permalink
fix: continue policy execution if namespaceObject cannot be fetched
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrizio Sestito <[email protected]>
  • Loading branch information
fabriziosestito committed Mar 21, 2024
1 parent 66037bc commit cb735b0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ func Validate(payload []byte) ([]byte, error) {

responseBytes, err := kubernetes.GetResource(&host, resourceRequest)
if err != nil {
return nil, fmt.Errorf("cannot get namespace data: %w", err)
}
if err := json.Unmarshal(responseBytes, &namespaceObject); err != nil {
log.Printf("Warning: cannot get namespace data: %s. `namespaceObject` cannot be populated.", err)
} else if err := json.Unmarshal(responseBytes, &namespaceObject); err != nil {
return nil, fmt.Errorf("cannot parse namespace data: %w", err)
}
}
Expand Down

0 comments on commit cb735b0

Please sign in to comment.