Run capabilities

This commit is contained in:
sophia 2021-04-27 16:51:37 -05:00 committed by Paul Hinze
parent 7ab060d70d
commit dfd604bd1b
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
3 changed files with 8 additions and 4 deletions

View File

@ -27,11 +27,10 @@ func (h *AlwaysTrueHost) Detect() bool {
}
func (h *AlwaysTrueHost) InitializeCapabilities() (err error) {
err = h.RegisterCapability("write_hello", cap.WriteHelloFunc)
err = h.RegisterCapability("write_hello", cap.WriteHelloFunc())
return
}
var (
_ component.Host = (*AlwaysTrueHost)(nil)
_ sdkcore.Host = (*AlwaysTrueHost)(nil)
)

View File

@ -2,13 +2,18 @@ package cap
import (
"io/ioutil"
"github.com/hashicorp/vagrant-plugin-sdk/terminal"
)
func WriteHelloFunc() interface{} {
return WriteHello
}
func WriteHello() {
func WriteHello(trm terminal.UI) error {
trm.Output("Writing to /tmp/dat1")
data := []byte("hello\ngo\n")
ioutil.WriteFile("/tmp/dat1", data, 0644)
return nil
}

View File

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