Skip to content

Commit

Permalink
Catch NotFound secret and provide more useful error message
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Hros <roman.hros@dnation.cloud>
  • Loading branch information
chess-knight committed Jan 12, 2024
1 parent 9c204d4 commit 597fc5d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/controller/openstacknodeimagerelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ func (r *OpenStackNodeImageReleaseReconciler) getCloudFromSecret(ctx context.Con
Name: secretName,
}, secret)
if err != nil {
if apierrors.IsNotFound(err) {
return emptyCloud, fmt.Errorf("secret %s in namespace %s does not exist: %w", secretName, secretNamespace, err)
}
return emptyCloud, fmt.Errorf("failed to get secret %s: %w", secretName, err)
}
content, ok := secret.Data[cloudsSecretKey]
Expand Down

0 comments on commit 597fc5d

Please sign in to comment.