mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Check existence of $HELM_HOME/plugins before installing plugin
Fixes https://github.com/kubernetes/helm/issues/2488
This commit is contained in:
parent
3ed1ccf5dc
commit
a6556b4982
1 changed files with 5 additions and 0 deletions
|
|
@ -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…
Reference in a new issue