Unverified Commit fa611fe2 authored by Adam Reese's avatar Adam Reese Committed by GitHub

fix(plugins): support installing plugins by relative path (#3568)

Support installing plugins by relative path

```
helm plugins install .
```
parent c314e2e2
......@@ -21,9 +21,9 @@ import (
"os"
"path"
"path/filepath"
"strings"
"k8s.io/helm/pkg/helm/helmpath"
"strings"
)
// ErrMissingMetadata indicates that plugin.yaml is missing.
......
......@@ -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"
......@@ -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
}
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment