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

Support installing plugins by relative path

```
helm plugins install .
```
pull/2919/merge
Adam Reese 6 years ago committed by GitHub
parent c314e2e2f1
commit fa611fe285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save