Commit 9a1bc1ae authored by Matt Butcher's avatar Matt Butcher Committed by GitHub

Merge pull request #2540 from yan234280533/uninstall-name-check

adjust the check parameter order for uninstall 
parents 577f8a82 d3b14db3
...@@ -30,12 +30,6 @@ import ( ...@@ -30,12 +30,6 @@ import (
// UninstallRelease deletes all of the resources associated with this release, and marks the release DELETED. // UninstallRelease deletes all of the resources associated with this release, and marks the release DELETED.
func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallReleaseRequest) (*services.UninstallReleaseResponse, error) { func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallReleaseRequest) (*services.UninstallReleaseResponse, error) {
err := s.env.Releases.LockRelease(req.Name)
if err != nil {
return nil, err
}
defer s.env.Releases.UnlockRelease(req.Name)
if !ValidName.MatchString(req.Name) { if !ValidName.MatchString(req.Name) {
s.Log("uninstall: Release not found: %s", req.Name) s.Log("uninstall: Release not found: %s", req.Name)
return nil, errMissingRelease return nil, errMissingRelease
...@@ -45,6 +39,12 @@ func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR ...@@ -45,6 +39,12 @@ func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR
return nil, fmt.Errorf("release name %q exceeds max length of %d", req.Name, releaseNameMaxLen) return nil, fmt.Errorf("release name %q exceeds max length of %d", req.Name, releaseNameMaxLen)
} }
err := s.env.Releases.LockRelease(req.Name)
if err != nil {
return nil, err
}
defer s.env.Releases.UnlockRelease(req.Name)
rels, err := s.env.Releases.History(req.Name) rels, err := s.env.Releases.History(req.Name)
if err != nil { if err != nil {
s.Log("uninstall: Release not loaded: %s", req.Name) s.Log("uninstall: Release not loaded: %s", req.Name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment