Skip to content

Commit

Permalink
Merge pull request #3705 from Azure/bvesel/fix-missed-dbrefactor
Browse files Browse the repository at this point in the history
Fix missing database refactor on preflight validation in frontend
  • Loading branch information
mociarain authored Jul 18, 2024
2 parents 7838c00 + 48e8abf commit 2506e51
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/frontend/openshiftcluster_preflightvalidation.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package frontend
import (
"context"
"encoding/json"
"fmt"
"net/http"
"strings"

Expand Down Expand Up @@ -76,7 +77,18 @@ func (f *frontend) preflightValidation(w http.ResponseWriter, r *http.Request) {

func (f *frontend) _preflightValidation(ctx context.Context, log *logrus.Entry, raw json.RawMessage, apiVersion string, resourceID string) api.ValidationResult {
log.Infof("running preflight validation on resource: %s", resourceID)
doc, err := f.dbOpenShiftClusters.Get(ctx, resourceID)
dbOpenShiftClusters, err := f.dbGroup.OpenShiftClusters()
if err != nil {
log.Error(err)
return api.ValidationResult{
Status: api.ValidationStatusFailed,
Error: &api.CloudErrorBody{
Message: fmt.Sprintf("500: %s", api.CloudErrorCodeInternalServerError),
},
}
}

doc, err := dbOpenShiftClusters.Get(ctx, resourceID)
isCreate := cosmosdb.IsErrorStatusCode(err, http.StatusNotFound)
if err != nil && !isCreate {
log.Warning(err.Error())
Expand Down

0 comments on commit 2506e51

Please sign in to comment.