Seed plugin on startup
This commit is contained in:
parent
09a836745a
commit
2bd95144e7
@ -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{}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user