mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
fix(plugins): add error when updating modified plugins
If git has autosetuprebase enabled pulling will fail without a descriptive error message.
This commit is contained in:
parent
15254e4c5c
commit
1e8ebae249
2 changed files with 7 additions and 3 deletions
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
package installer // import "k8s.io/helm/pkg/plugin/installer"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
|
|
@ -92,6 +93,9 @@ func (i *VCSInstaller) Install() error {
|
|||
// Update updates a remote repository
|
||||
func (i *VCSInstaller) Update() error {
|
||||
debug("updating %s", i.Repo.Remote())
|
||||
if i.Repo.IsDirty() {
|
||||
return errors.New("plugin repo was modified")
|
||||
}
|
||||
if err := i.Repo.Update(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,9 +195,9 @@ func TestVCSInstallerUpdate(t *testing.T) {
|
|||
os.Remove(filepath.Join(i.Path(), "plugin.yaml"))
|
||||
// Testing update for error
|
||||
if err := Update(i); err == nil {
|
||||
t.Error("expected error for plugin metadata missing, got none")
|
||||
} else if err.Error() != "plugin metadata (plugin.yaml) missing" {
|
||||
t.Errorf("expected error for plugin metadata missing, got (%v)", err)
|
||||
t.Error("expected error for plugin modified, got none")
|
||||
} else if err.Error() != "plugin repo was modified" {
|
||||
t.Errorf("expected error for plugin modified, got (%v)", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue