Skip to content

Commit

Permalink
Check existence of $HELM_HOME/plugins before installing plugin
Browse files Browse the repository at this point in the history
Fixes helm#2488
  • Loading branch information
Sushil Kumar authored and flynnduism committed May 28, 2017
1 parent 0fad699 commit ef1b297
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/plugin/installer/installer.go
Expand Up @@ -19,6 +19,7 @@ import (
"errors"
"fmt"
"os"
"path"
"path/filepath"

"k8s.io/helm/pkg/helm/helmpath"
Expand All @@ -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")
}
Expand Down

0 comments on commit ef1b297

Please sign in to comment.