diff --git a/builtin/otherplugin/command.go b/builtin/otherplugin/command.go index ee3fa2f82..1bef1c037 100644 --- a/builtin/otherplugin/command.go +++ b/builtin/otherplugin/command.go @@ -158,8 +158,12 @@ func (c *Command) ExecuteOfni(trm terminal.UI) int64 { func (c *Command) ExecuteUseHostPlugin(trm terminal.UI, host plugincore.Host) int64 { trm.Output("I'm going to use a the host plugin to do something!") + host.HasCapability("write_hello") if ok, _ := host.HasCapability("write_hello"); ok { + trm.Output("Writing to file using `write_hello` capability") host.Capability("write_hello", argmapper.Typed(trm)) + } else { + trm.Output("no `write_hello` capability found") } return 0 } diff --git a/internal/core/basis.go b/internal/core/basis.go index f3d9979e2..dc193bd64 100644 --- a/internal/core/basis.go +++ b/internal/core/basis.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/vagrant-plugin-sdk/component" "github.com/hashicorp/vagrant-plugin-sdk/core" "github.com/hashicorp/vagrant-plugin-sdk/datadir" + "github.com/hashicorp/vagrant-plugin-sdk/internal-shared/componentprotomappers" "github.com/hashicorp/vagrant-plugin-sdk/internal-shared/protomappers" "github.com/hashicorp/vagrant-plugin-sdk/proto/vagrant_plugin_sdk" "github.com/hashicorp/vagrant-plugin-sdk/terminal" @@ -95,7 +96,8 @@ func NewBasis(ctx context.Context, opts ...BasisOption) (b *Basis, err error) { // If the mappers aren't already set, load known mappers if len(b.mappers) == 0 { - b.mappers, err = argmapper.NewFuncList(protomappers.All, + mappers := append(protomappers.All, componentprotomappers.All...) + b.mappers, err = argmapper.NewFuncList(mappers, argmapper.Logger(b.logger), ) if err != nil { diff --git a/internal/core/project.go b/internal/core/project.go index 721f8c6cd..1b436b635 100644 --- a/internal/core/project.go +++ b/internal/core/project.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/vagrant-plugin-sdk/proto/vagrant_plugin_sdk" "github.com/hashicorp/vagrant-plugin-sdk/terminal" + alwaysTrueHost "github.com/hashicorp/vagrant/builtin/myplugin/host" "github.com/hashicorp/vagrant/internal/config" "github.com/hashicorp/vagrant/internal/factory" "github.com/hashicorp/vagrant/internal/plugin" @@ -232,7 +233,13 @@ func (p *Project) Components(ctx context.Context) (results []*Component, err err func (p *Project) Run(ctx context.Context, task *vagrant_server.Task) (err error) { p.logger.Debug("running new task", "project", p, "task", task) + hostPluginName, err := p.findHostPlugin(ctx) + if hostPluginName != "" { + + } cmd, err := p.basis.component(ctx, component.CommandType, task.Component.Name) + // hostPlugin, err := p.basis.component(ctx, component.HostType, hostPluginName) + if err != nil { return err } diff --git a/internal/plugin/plugin.go b/internal/plugin/plugin.go index af7015722..ed3cb546f 100644 --- a/internal/plugin/plugin.go +++ b/internal/plugin/plugin.go @@ -9,7 +9,7 @@ import ( ) // disable in process plugins by default for now -const IN_PROCESS_PLUGINS = false +const IN_PROCESS_PLUGINS = true var ( // Builtins is the map of all available builtin plugins and their