diff --git a/builtin/myplugin/host/alwaystrue.go b/builtin/myplugin/host/alwaystrue.go index 8a48834e0..e251d7e2b 100644 --- a/builtin/myplugin/host/alwaystrue.go +++ b/builtin/myplugin/host/alwaystrue.go @@ -4,7 +4,6 @@ import ( "errors" "github.com/hashicorp/vagrant-plugin-sdk/component" - // "github.com/hashicorp/vagrant-plugin-sdk/core" "github.com/hashicorp/vagrant-plugin-sdk/terminal" "github.com/hashicorp/vagrant/builtin/myplugin/host/cap" ) @@ -26,6 +25,16 @@ func (h *AlwaysTrueHost) Detect() bool { return true } +// ParentsFunc implements component.Host +func (h *AlwaysTrueHost) ParentsFunc() interface{} { + return h.Parents +} + +func (h *AlwaysTrueHost) Parents() []string { + return []string{"force", "host", "platform", "match"} // We just need to have this be the most of all matches +} + +// HasCapabilityFunc implements component.Host func (h *AlwaysTrueHost) HasCapabilityFunc() interface{} { return h.CheckCapability } @@ -37,6 +46,7 @@ func (h *AlwaysTrueHost) CheckCapability(n *component.NamedCapability) bool { return false } +// CapabilityFunc implements component.Host func (h *AlwaysTrueHost) CapabilityFunc(name string) interface{} { if name == "write_hello" { return h.WriteHelloCap @@ -48,10 +58,6 @@ func (h *AlwaysTrueHost) WriteHelloCap(ui terminal.UI) error { return cap.WriteHello(ui) } -func (h *AlwaysTrueHost) WriteHelloCapNoUI() error { - return cap.WriteHelloNoUI() -} - var ( _ component.Host = (*AlwaysTrueHost)(nil) ) diff --git a/builtin/myplugin/host/cap/write_hello.go b/builtin/myplugin/host/cap/write_hello.go index d8f298750..177914b01 100644 --- a/builtin/myplugin/host/cap/write_hello.go +++ b/builtin/myplugin/host/cap/write_hello.go @@ -1,22 +1,11 @@ package cap import ( - "io/ioutil" - "github.com/hashicorp/vagrant-plugin-sdk/terminal" ) func WriteHello(ui terminal.UI) error { msg := "Hello from the write hello capability, compliments of the AlwaysTrue Host" ui.Output(msg) - data := []byte(msg) - ioutil.WriteFile("/tmp/hello", data, 0644) - return nil -} - -func WriteHelloNoUI() error { - msg := "Hello from the write hello capability, compliments of the AlwaysTrue Host" - data := []byte(msg) - ioutil.WriteFile("/tmp/hello", data, 0644) return nil }