Skip to content
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

Merged
merged 3 commits into from
Sep 5, 2022
Merged

fix: create renamed template without reporting error #182

merged 3 commits into from
Sep 5, 2022

Conversation

Metrora
Copy link
Contributor

@Metrora Metrora commented Sep 2, 2022

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?

None

Additional documentation, usage docs, etc.:


@kubeclipper-bot kubeclipper-bot added release-note-none kind/bug Categorizes issue or PR as related to a bug. dco-signoff: no size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 2, 2022
Signed-off-by: Liucw <liu.chuwei@99cloud.net>
}

if len(templates.Items) > 0 {
restplus.HandleInternalError(response, request, fmt.Errorf("template '%s' already exists", template.Annotations[common.AnnotationDisplayName]))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad request

response.WriteHeader(http.StatusOK)
}

func (h *handler) checkTemplate(ctx context.Context, name string) (bool, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename checkTemplateExist

@@ -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{
Copy link
Collaborator

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-commenter
Copy link

codecov-commenter commented Sep 5, 2022

Codecov Report

Merging #182 (3f21197) into master (f4273e0) will decrease coverage by 0.04%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
pkg/apis/core/v1/handler.go 0.33% <0.00%> (-0.01%) ⬇️
pkg/apis/core/v1/registry.go 0.00% <0.00%> (ø)
pkg/proxy/proxy.go 0.00% <0.00%> (ø)

Required(false).
DataFormat("fieldSelector=%s=%s")).
Returns(http.StatusOK, http.StatusText(http.StatusOK), nil).
Returns(http.StatusNotFound, http.StatusText(http.StatusNotFound), nil))
Copy link
Collaborator

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>
@x893675
Copy link
Collaborator

x893675 commented Sep 5, 2022

/lgtm
/approve

@kubeclipper-bot kubeclipper-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 5, 2022
@kubeclipper-bot
Copy link
Collaborator

LGTM label has been added.

Git tree hash: 43c5045f7ec5053f285c45c62b358bb52d9b2520

@kubeclipper-bot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubeclipper-bot kubeclipper-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 5, 2022
@kubeclipper-bot kubeclipper-bot merged commit a06452b into kubeclipper:master Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note-none size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create renamed templates without reporting error when create cluster and plugin templates
4 participants