Commit d3b14db3 authored by devinyan's avatar devinyan

adjust the check parameter order for uninstall

parent 577f8a82
......@@ -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)
......
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