From d3b14db325e2873fc389f091454f3cc034a52e64 Mon Sep 17 00:00:00 2001 From: devinyan Date: Sat, 3 Jun 2017 10:17:30 +0800 Subject: [PATCH] adjust the check parameter order for uninstall --- pkg/tiller/release_uninstall.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/tiller/release_uninstall.go b/pkg/tiller/release_uninstall.go index 8f7846d68..54971ee6e 100644 --- a/pkg/tiller/release_uninstall.go +++ b/pkg/tiller/release_uninstall.go @@ -30,12 +30,6 @@ import ( // 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) { - 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) { s.Log("uninstall: Release not found: %s", req.Name) return nil, errMissingRelease @@ -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) } + 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) if err != nil { s.Log("uninstall: Release not loaded: %s", req.Name)