Run capabilities
This commit is contained in:
parent
7ab060d70d
commit
dfd604bd1b
@ -27,11 +27,10 @@ func (h *AlwaysTrueHost) Detect() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *AlwaysTrueHost) InitializeCapabilities() (err error) {
|
func (h *AlwaysTrueHost) InitializeCapabilities() (err error) {
|
||||||
err = h.RegisterCapability("write_hello", cap.WriteHelloFunc)
|
err = h.RegisterCapability("write_hello", cap.WriteHelloFunc())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ component.Host = (*AlwaysTrueHost)(nil)
|
_ component.Host = (*AlwaysTrueHost)(nil)
|
||||||
_ sdkcore.Host = (*AlwaysTrueHost)(nil)
|
|
||||||
)
|
)
|
||||||
|
|||||||
@ -2,13 +2,18 @@ package cap
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
|
"github.com/hashicorp/vagrant-plugin-sdk/terminal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func WriteHelloFunc() interface{} {
|
func WriteHelloFunc() interface{} {
|
||||||
return WriteHello
|
return WriteHello
|
||||||
}
|
}
|
||||||
|
|
||||||
func WriteHello() {
|
func WriteHello(trm terminal.UI) error {
|
||||||
|
trm.Output("Writing to /tmp/dat1")
|
||||||
|
|
||||||
data := []byte("hello\ngo\n")
|
data := []byte("hello\ngo\n")
|
||||||
ioutil.WriteFile("/tmp/dat1", data, 0644)
|
ioutil.WriteFile("/tmp/dat1", data, 0644)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// disable in process plugins by default for now
|
// disable in process plugins by default for now
|
||||||
const IN_PROCESS_PLUGINS = false
|
const IN_PROCESS_PLUGINS = true
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// Builtins is the map of all available builtin plugins and their
|
// Builtins is the map of all available builtin plugins and their
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user