Skip to content

Commit ad9b93b

Browse files
committed
Load local plugin for project when loading the project
1 parent b9ab3ec commit ad9b93b

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

internal/client/basis.go

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
"github.com/hashicorp/vagrant-plugin-sdk/config"
1414
"github.com/hashicorp/vagrant-plugin-sdk/helper/path"
15+
"github.com/hashicorp/vagrant-plugin-sdk/helper/paths"
1516
"github.com/hashicorp/vagrant-plugin-sdk/proto/vagrant_plugin_sdk"
1617
"github.com/hashicorp/vagrant-plugin-sdk/terminal"
1718
"github.com/hashicorp/vagrant/internal/server/proto/vagrant_server"
@@ -44,6 +45,11 @@ func (b *Basis) DetectProject() (p *Project, err error) {
4445
if err != nil && status.Code(err) != codes.NotFound {
4546
return
4647
}
48+
dataPath, err := paths.VagrantData()
49+
if err != nil {
50+
return
51+
}
52+
b.client.LoadLocalProjectPlugins(dataPath.Join(b.basis.Name, "project", p.project.Name).String())
4753

4854
if err == nil {
4955
p.vagrantfile = v

internal/client/client.go

+4
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ func (c *Client) UI() terminal.UI {
201201
return c.ui
202202
}
203203

204+
func (c *Client) LoadLocalProjectPlugins(path string) error {
205+
return c.runner.LoadLocalProjectPlugins(path)
206+
}
207+
204208
type clientConfig struct {
205209
connectOpts []serverclient.ConnectOption
206210
}

internal/runner/runner.go

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ func New(opts ...Option) (*Runner, error) {
157157
}
158158

159159
func (r *Runner) LoadLocalProjectPlugins(path string) error {
160+
// TODO: should this check if the runner is local?
160161
err := r.plugins.LoadLocalLegacyPlugins(
161162
r.vagrantRubyClient, r.vagrantRubyRuntime, path)
162163
return err

0 commit comments

Comments
 (0)