From bc095b06dcf4b887474a61aad1bb2bf9f0804338 Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 28 Apr 2021 10:00:52 -0500 Subject: [PATCH] Don't initialize hosts with basis --- builtin/myplugin/host/cap/write_hello.go | 6 ++-- internal/core/basis.go | 46 ------------------------ internal/plugin/plugin.go | 2 +- 3 files changed, 4 insertions(+), 50 deletions(-) diff --git a/builtin/myplugin/host/cap/write_hello.go b/builtin/myplugin/host/cap/write_hello.go index 73c5b4ec2..1d33f19ef 100644 --- a/builtin/myplugin/host/cap/write_hello.go +++ b/builtin/myplugin/host/cap/write_hello.go @@ -11,9 +11,9 @@ func WriteHelloFunc() interface{} { } func WriteHello(trm terminal.UI) error { - trm.Output("Writing to /tmp/dat1") + trm.Output("Writing hello to /tmp/hello") - data := []byte("hello\ngo\n") - ioutil.WriteFile("/tmp/dat1", data, 0644) + data := []byte("hello from the always true host plugin\n") + ioutil.WriteFile("/tmp/hello", data, 0644) return nil } diff --git a/internal/core/basis.go b/internal/core/basis.go index b642ec188..d4d4963ae 100644 --- a/internal/core/basis.go +++ b/internal/core/basis.go @@ -134,51 +134,6 @@ func (b *Basis) Environment() *Environment { return b.env } -func (b *Basis) initHosts(ctx context.Context) error { - f := b.factories[component.HostType] - for _, name := range f.Registered() { - if name != "myplugin" { - continue - } - h, err := componentCreatorMap[component.HostType].Create(context.Background(), b, name) - if err != nil { - return err - } - detected, err := b.callDynamicFunc( - ctx, - b.logger, - (interface{})(nil), - h, - h.Value.(component.Host).DetectFunc(), - ) - if detected.(bool) == false { - return err - } - hasCap, err := b.callDynamicFunc( - ctx, - b.logger, - (interface{})(nil), - h, - h.Value.(component.Host).HasCapabilityFunc(), - argmapper.Typed("write_hello"), - ) - if hasCap.(bool) { - _, err := b.callDynamicFunc( - ctx, - b.logger, - (interface{})(nil), - h, - h.Value.(component.Host).CapabilityFunc("write_hello"), - argmapper.Typed(b.UI), - ) - if err != nil { - return err - } - } - } - return nil -} - func (b *Basis) Init() (result *vagrant_server.Job_InitResult, err error) { b.logger.Debug("running init for basis") f := b.factories[component.CommandType] @@ -186,7 +141,6 @@ func (b *Basis) Init() (result *vagrant_server.Job_InitResult, err error) { Commands: []*vagrant_server.Job_Command{}, } ctx := context.Background() - b.initHosts(ctx) for _, name := range f.Registered() { var cmd *Component diff --git a/internal/plugin/plugin.go b/internal/plugin/plugin.go index ed3cb546f..af7015722 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 = true +const IN_PROCESS_PLUGINS = false var ( // Builtins is the map of all available builtin plugins and their