Skip to content

Commit

Permalink
fix clusterName and another issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaqiluo committed Dec 3, 2022
1 parent 7da3397 commit 0fbc029
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
5 changes: 1 addition & 4 deletions parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,7 @@ func parseAction(url *url.URL) (string, string) {
}

func Body(req *http.Request) (map[string]interface{}, error) {
err := req.ParseMultipartForm(maxFormSize)
if err != nil {
return nil, err
}
_ = req.ParseMultipartForm(maxFormSize)
if req.MultipartForm != nil {
return valuesToBody(req.MultipartForm.Value), nil
}
Expand Down
2 changes: 1 addition & 1 deletion types/mapper/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func NewMetadataMapper() types.Mapper {
Move{From: "creationTimestamp", To: "created"},
Move{From: "deletionTimestamp", To: "removed"},
Drop{Field: "deletionGracePeriodSeconds"},
Drop{Field: "clusterName"},
Drop{Field: "clusterName", IgnoreDefinition: true},
ReadOnly{Field: "*"},
Access{
Fields: map[string]string{
Expand Down
7 changes: 2 additions & 5 deletions types/mapper/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package mapper

import (
"fmt"

"strings"

"github.com/rancher/norman/types"
Expand Down Expand Up @@ -39,13 +38,11 @@ func (m Move) ModifySchema(s *types.Schema, schemas *types.Schemas) error {
return fmt.Errorf("failed to find field %s on schema %s", m.From, s.ID)
}

toSchema, toFieldName, _, ok, err := getField(s, schemas, m.To)
toSchema, toFieldName, _, _, err := getField(s, schemas, m.To)
if err != nil {
return err
}
if !ok {
return fmt.Errorf("failed to find field %s on schema %s", m.To, s.ID)
}

_, ok = toSchema.ResourceFields[toFieldName]
if ok && !strings.Contains(m.To, "/") && !m.DestDefined {
return fmt.Errorf("field %s already exists on schema %s", m.To, s.ID)
Expand Down

0 comments on commit 0fbc029

Please sign in to comment.