Don't initialize hosts with basis

This commit is contained in:
sophia 2021-04-28 10:00:52 -05:00 committed by Paul Hinze
parent dfd604bd1b
commit bc095b06dc
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
3 changed files with 4 additions and 50 deletions

View File

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

View File

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

View File

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