Seed plugin on startup

This commit is contained in:
sophia 2021-10-18 16:18:11 -05:00 committed by Paul Hinze
parent 09a836745a
commit 2bd95144e7
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -11,6 +11,7 @@ import (
sdk "github.com/hashicorp/vagrant-plugin-sdk"
"github.com/hashicorp/vagrant-plugin-sdk/component"
"github.com/hashicorp/vagrant-plugin-sdk/core"
"github.com/hashicorp/vagrant-plugin-sdk/internal-shared/cacher"
"github.com/hashicorp/vagrant/builtin/myplugin"
"github.com/hashicorp/vagrant/builtin/otherplugin"
@ -190,6 +191,18 @@ func (p *Plugin) InstanceOf(
return
}
func (p *Plugin) SeedPlugin(typ component.Type, args ...interface{}) error {
seedTarget := p.components[typ].Component
if s, ok := seedTarget.(core.Seeder); ok {
if err := s.Seed(args...); err != nil {
return err
}
} else {
return fmt.Errorf("host plugin does not support seeder interface")
}
return nil
}
// Helper that returns supported types as strings
func (p *Plugin) types() []string {
result := []string{}