Commit 1e8ebae2 authored by Adam Reese's avatar Adam Reese Committed by Adam Reese

fix(plugins): add error when updating modified plugins

If git has autosetuprebase enabled pulling will fail without a
descriptive error message.
parent 15254e4c
...@@ -16,6 +16,7 @@ limitations under the License. ...@@ -16,6 +16,7 @@ limitations under the License.
package installer // import "k8s.io/helm/pkg/plugin/installer" package installer // import "k8s.io/helm/pkg/plugin/installer"
import ( import (
"errors"
"fmt" "fmt"
"os" "os"
"sort" "sort"
...@@ -92,6 +93,9 @@ func (i *VCSInstaller) Install() error { ...@@ -92,6 +93,9 @@ func (i *VCSInstaller) Install() error {
// Update updates a remote repository // Update updates a remote repository
func (i *VCSInstaller) Update() error { func (i *VCSInstaller) Update() error {
debug("updating %s", i.Repo.Remote()) debug("updating %s", i.Repo.Remote())
if i.Repo.IsDirty() {
return errors.New("plugin repo was modified")
}
if err := i.Repo.Update(); err != nil { if err := i.Repo.Update(); err != nil {
return err return err
} }
......
...@@ -195,9 +195,9 @@ func TestVCSInstallerUpdate(t *testing.T) { ...@@ -195,9 +195,9 @@ func TestVCSInstallerUpdate(t *testing.T) {
os.Remove(filepath.Join(i.Path(), "plugin.yaml")) os.Remove(filepath.Join(i.Path(), "plugin.yaml"))
// Testing update for error // Testing update for error
if err := Update(i); err == nil { if err := Update(i); err == nil {
t.Error("expected error for plugin metadata missing, got none") t.Error("expected error for plugin modified, got none")
} else if err.Error() != "plugin metadata (plugin.yaml) missing" { } else if err.Error() != "plugin repo was modified" {
t.Errorf("expected error for plugin metadata missing, got (%v)", err) t.Errorf("expected error for plugin modified, got (%v)", err)
} }
} }
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