1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-02 07:44:51 +00:00

workaround unimplementd ref validator

This commit is contained in:
Craig Jellick
2017-12-15 19:22:10 -07:00
committed by Darren Shepherd
parent 8c0d4bfe2e
commit df13831994

View File

@@ -31,7 +31,7 @@ func ValidateAction(request *types.APIContext) (*types.Action, error) {
return nil, httperror.NewAPIError(httperror.InvalidAction, fmt.Sprintf("Invalid action: %s", request.Action)) return nil, httperror.NewAPIError(httperror.InvalidAction, fmt.Sprintf("Invalid action: %s", request.Action))
} }
if request.ID != "" { if request.ID != "" && request.ReferenceValidator != nil {
resource := request.ReferenceValidator.Lookup(request.Type, request.ID) resource := request.ReferenceValidator.Lookup(request.Type, request.ID)
if resource == nil { if resource == nil {
return nil, httperror.NewAPIError(httperror.NotFound, fmt.Sprintf("Failed to find type: %s id: %s", request.Type, request.ID)) return nil, httperror.NewAPIError(httperror.NotFound, fmt.Sprintf("Failed to find type: %s id: %s", request.Type, request.ID))