Skip to content

Commit

Permalink
fix(plugins): support installing plugins by relative path (helm#3568)
Browse files Browse the repository at this point in the history
Support installing plugins by relative path

```
helm plugins install .
```
  • Loading branch information
adamreese authored Feb 26, 2018
1 parent c314e2e commit fa611fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/plugin/installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"os"
"path"
"path/filepath"
"strings"

"k8s.io/helm/pkg/helm/helmpath"
"strings"
)

// ErrMissingMetadata indicates that plugin.yaml is missing.
Expand Down
13 changes: 7 additions & 6 deletions pkg/plugin/installer/local_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.
package installer // import "k8s.io/helm/pkg/plugin/installer"

import (
"fmt"
"path/filepath"

"k8s.io/helm/pkg/helm/helmpath"
Expand All @@ -28,8 +29,12 @@ type LocalInstaller struct {

// NewLocalInstaller creates a new LocalInstaller.
func NewLocalInstaller(source string, home helmpath.Home) (*LocalInstaller, error) {
src, err := filepath.Abs(source)
if err != nil {
return nil, fmt.Errorf("unable to get absolute path to plugin: %v", err)
}
i := &LocalInstaller{
base: newBase(source, home),
base: newBase(src, home),
}
return i, nil
}
Expand All @@ -41,11 +46,7 @@ func (i *LocalInstaller) Install() error {
if !isPlugin(i.Source) {
return ErrMissingMetadata
}
src, err := filepath.Abs(i.Source)
if err != nil {
return err
}
return i.link(src)
return i.link(i.Source)
}

// Update updates a local repository
Expand Down

0 comments on commit fa611fe

Please sign in to comment.