Merge pull request #2500 from sushilkm/issues/2488

Check existence of $HELM_HOME/plugins before installing plugin
pull/205/merge
Taylor Thomas 7 years ago committed by GitHub
commit 7a49e5c3e1

@ -19,6 +19,7 @@ import (
"errors"
"fmt"
"os"
"path"
"path/filepath"
"k8s.io/helm/pkg/helm/helmpath"
@ -42,6 +43,10 @@ type Installer interface {
// Install installs a plugin to $HELM_HOME.
func Install(i Installer) error {
if _, pathErr := os.Stat(path.Dir(i.Path())); os.IsNotExist(pathErr) {
return errors.New(`plugin home "$HELM_HOME/plugins" does not exists`)
}
if _, pathErr := os.Stat(i.Path()); !os.IsNotExist(pathErr) {
return errors.New("plugin already exists")
}

Loading…
Cancel
Save