Fix outputting twice the docker stack rm error message
@@ -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
