Fix outputting twice the docker stack rm error message

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
This commit is contained in:
Silvin Lubecki 2018-05-30 15:20:44 +02:00
parent 66059a925b
commit a252cb1197
1 changed files with 3 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"github.com/docker/cli/cli/command/stack/options"
"github.com/pkg/errors"
)
// RunRemove is the kubernetes implementation of docker stack remove
@ -18,10 +19,8 @@ func RunRemove(dockerCli *KubeCli, opts options.Remove) error {
}
for _, stack := range opts.Namespaces {
fmt.Fprintf(dockerCli.Out(), "Removing stack: %s\n", stack)
err := stacks.Delete(stack)
if err != nil {
fmt.Fprintf(dockerCli.Out(), "Failed to remove stack %s: %s\n", stack, err)
return err
if err := stacks.Delete(stack); err != nil {
return errors.Wrapf(err, "Failed to remove stack %s", stack)
}
}
return nil