зеркало из https://github.com/Azure/ARO-RP.git
Merge pull request #624 from asalkeld/better-multi-kind-error
Add a better message when the groupKind matches multiple
This commit is contained in:
Коммит
2ae34f5050
|
@ -89,9 +89,13 @@ func (ka *kubeactions) findGVR(apiresourcelist []*metav1.APIResourceList, groupK
|
|||
}
|
||||
|
||||
if len(matches) > 1 {
|
||||
var matchesGK []string
|
||||
for _, match := range matches {
|
||||
matchesGK = append(matchesGK, groupKind+"."+match.Group)
|
||||
}
|
||||
return nil, api.NewCloudError(
|
||||
http.StatusBadRequest, api.CloudErrorCodeInvalidParameter,
|
||||
"", "The groupKind '%s' matched multiple groupKinds.", groupKind)
|
||||
"", "The groupKind '%s' matched multiple groupKinds (%s).", groupKind, strings.Join(matchesGK, ", "))
|
||||
}
|
||||
|
||||
return matches[0], nil
|
||||
|
|
|
@ -130,7 +130,7 @@ func TestFindGVR(t *testing.T) {
|
|||
want: nil,
|
||||
wantErr: api.NewCloudError(
|
||||
http.StatusBadRequest, api.CloudErrorCodeInvalidParameter,
|
||||
"", "The groupKind '%s' matched multiple groupKinds.", "baremetalhost"),
|
||||
"", "The groupKind '%s' matched multiple groupKinds (baremetalhost.metal3.io, baremetalhost.plastic.io).", "baremetalhost"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче