diff --git a/cmd/helm/plugin_remove.go b/cmd/helm/plugin_remove.go index 6eec206d5..e7e522d51 100644 --- a/cmd/helm/plugin_remove.go +++ b/cmd/helm/plugin_remove.go @@ -20,6 +20,7 @@ import ( "fmt" "io" "os" + "strings" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/plugin" @@ -64,18 +65,21 @@ func (pcmd *pluginRemoveCmd) run() error { if err != nil { return err } - + var errorPlugins []string for _, name := range pcmd.names { if found := findPlugin(plugins, name); found != 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 { fmt.Fprintf(pcmd.out, "Removed plugin: %s\n", name) } } 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 }