-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: create renamed template without reporting error #182
Conversation
Signed-off-by: Liucw <liu.chuwei@99cloud.net>
pkg/apis/core/v1/handler.go
Outdated
} | ||
|
||
if len(templates.Items) > 0 { | ||
restplus.HandleInternalError(response, request, fmt.Errorf("template '%s' already exists", template.Annotations[common.AnnotationDisplayName])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad request
pkg/apis/core/v1/handler.go
Outdated
response.WriteHeader(http.StatusOK) | ||
} | ||
|
||
func (h *handler) checkTemplate(ctx context.Context, name string) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename checkTemplateExist
pkg/apis/core/v1/handler.go
Outdated
@@ -2508,6 +2508,22 @@ func (h *handler) CreateTemplate(request *restful.Request, response *restful.Res | |||
restplus.HandleInternalError(response, request, err) | |||
return | |||
} | |||
|
|||
q := query.New() | |||
q.FuzzySearch = map[string]string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use checkTemplateExist()
Signed-off-by: Liucw <liu.chuwei@99cloud.net>
Codecov Report
@@ Coverage Diff @@
## master #182 +/- ##
==========================================
- Coverage 13.04% 13.00% -0.05%
==========================================
Files 105 105
Lines 15970 16021 +51
==========================================
Hits 2084 2084
- Misses 13635 13686 +51
Partials 251 251
|
pkg/apis/core/v1/registry.go
Outdated
Required(false). | ||
DataFormat("fieldSelector=%s=%s")). | ||
Returns(http.StatusOK, http.StatusText(http.StatusOK), nil). | ||
Returns(http.StatusNotFound, http.StatusText(http.StatusNotFound), nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use http.StatusInternalServerError instead of http.StatusNotFound
Signed-off-by: Liucw <liu.chuwei@99cloud.net>
/lgtm |
LGTM label has been added. Git tree hash: 43c5045f7ec5053f285c45c62b358bb52d9b2520
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Metrora, x893675 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #171
Special notes for reviewers:
Does this PR introduced a user-facing change?
Additional documentation, usage docs, etc.: