Commit 084bbfa2 authored by Sushil Kumar's avatar Sushil Kumar

Return error exit-code in case of error

parent 24157e4a
...@@ -20,6 +20,7 @@ import ( ...@@ -20,6 +20,7 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"strings"
"k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/helmpath"
"k8s.io/helm/pkg/plugin" "k8s.io/helm/pkg/plugin"
...@@ -64,17 +65,20 @@ func (pcmd *pluginRemoveCmd) run() error { ...@@ -64,17 +65,20 @@ func (pcmd *pluginRemoveCmd) run() error {
if err != nil { if err != nil {
return err return err
} }
var errorPlugins []string
for _, name := range pcmd.names { for _, name := range pcmd.names {
if found := findPlugin(plugins, name); found != nil { if found := findPlugin(plugins, name); found != nil {
if err := removePlugin(found, pcmd.home); err != nil { if err := removePlugin(found, pcmd.home); err != nil {
fmt.Fprintf(pcmd.out, "Failed to remove plugin %s, got error (%v)\n", name, err) errorPlugins = append(errorPlugins, fmt.Sprintf("Failed to remove plugin %s, got error (%v)", name, err))
} else { } else {
fmt.Fprintf(pcmd.out, "Removed plugin: %s\n", name) fmt.Fprintf(pcmd.out, "Removed plugin: %s\n", name)
} }
} else { } else {
fmt.Fprintf(pcmd.out, "Plugin: %s not found\n", name) errorPlugins = append(errorPlugins, fmt.Sprintf("Plugin: %s not found", name))
}
} }
if len(errorPlugins) > 0 {
return fmt.Errorf(strings.Join(errorPlugins, "\n"))
} }
return nil return nil
} }
......
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