diff --git a/cmd/helm/plugin_update.go b/cmd/helm/plugin_update.go index f5615c6a8..e4fbe18df 100644 --- a/cmd/helm/plugin_update.go +++ b/cmd/helm/plugin_update.go @@ -19,13 +19,13 @@ import ( "errors" "fmt" "io" + "path/filepath" + "strings" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/plugin" "k8s.io/helm/pkg/plugin/installer" - "path/filepath" - "github.com/spf13/cobra" ) @@ -67,17 +67,22 @@ func (pcmd *pluginUpdateCmd) run() error { if err != nil { return err } + var errorPlugins []string + for _, name := range pcmd.names { if found := findPlugin(plugins, name); found != nil { if err := updatePlugin(found, pcmd.home); err != nil { - fmt.Fprintf(pcmd.out, "Failed to update plugin %s, got error (%v)\n", name, err) + errorPlugins = append(errorPlugins, fmt.Sprintf("Failed to update plugin %s, got error (%v)", name, err)) } else { fmt.Fprintf(pcmd.out, "Updated 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 } diff --git a/pkg/plugin/installer/vcs_installer_test.go b/pkg/plugin/installer/vcs_installer_test.go index d86c9b608..cb346c661 100644 --- a/pkg/plugin/installer/vcs_installer_test.go +++ b/pkg/plugin/installer/vcs_installer_test.go @@ -104,13 +104,6 @@ func TestVCSInstaller(t *testing.T) { } else if err.Error() != "cannot get information about plugin source" { t.Errorf("expected error for inability to find plugin source, got (%v)", err) } - - // Testing update for error - if err := Update(i); err == nil { - t.Error("expected error for plugin does not exist, got none") - } else if err.Error() != "plugin does not exist" { - t.Errorf("expected error for plugin does not exist, got (%v)", err) - } } func TestVCSInstallerNonExistentVersion(t *testing.T) {