From 2bd95144e7a318f6d17a9ae07feeddf4ca6f2941 Mon Sep 17 00:00:00 2001 From: sophia Date: Mon, 18 Oct 2021 16:18:11 -0500 Subject: [PATCH] Seed plugin on startup --- internal/plugin/plugin.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/plugin/plugin.go b/internal/plugin/plugin.go index 721d72600..e864f4bc0 100644 --- a/internal/plugin/plugin.go +++ b/internal/plugin/plugin.go @@ -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{}