fix(helm): improve --dry-run for helm delete

pull/734/head
Matt Butcher 9 years ago
parent 5ddae22a09
commit 1a3b563fb9

@ -2,7 +2,6 @@ package main
import (
"errors"
"fmt"
"github.com/kubernetes/helm/pkg/helm"
"github.com/spf13/cobra"
@ -37,13 +36,7 @@ func delRelease(cmd *cobra.Command, args []string) error {
return errors.New("command 'delete' requires a release name")
}
// TODO: Handle dry run use case.
if deleteDryRun {
fmt.Printf("DRY RUN: Deleting %s\n", args[0])
return nil
}
_, err := helm.UninstallRelease(args[0])
_, err := helm.UninstallRelease(args[0], deleteDryRun)
if err != nil {
return prettyError(err)
}

@ -66,7 +66,17 @@ func UpdateRelease(name string) (*services.UpdateReleaseResponse, error) {
}
// UninstallRelease uninstalls a named release and returns the response.
func UninstallRelease(name string) (*services.UninstallReleaseResponse, error) {
func UninstallRelease(name string, dryRun bool) (*services.UninstallReleaseResponse, error) {
if dryRun {
// In the dry run case, just see if the release exists.
res, err := GetReleaseContent(name)
if err != nil {
return &services.UninstallReleaseResponse{}, err
}
return &services.UninstallReleaseResponse{Release: res.Release}, nil
}
u := &services.UninstallReleaseRequest{
Name: name,
}

Loading…
Cancel
Save