Use project for host capabilities

This commit is contained in:
Chris Roberts 2021-10-18 15:09:58 -07:00 committed by Paul Hinze
parent 2d7ce1b9d8
commit 7cc07642a5
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
3 changed files with 15 additions and 10 deletions

View File

@ -257,14 +257,6 @@ func (b *Basis) Host() (host core.Host, err error) {
return nil, fmt.Errorf("failed to detect host plugin for current platform")
}
if s, ok := result.(core.Seeder); ok {
if err = s.Seed(b.statebag); err != nil {
return nil, err
}
} else {
return nil, fmt.Errorf("host plugin does not support seeder interface")
}
b.logger.Info("host detection complete",
"name", result_name)

View File

@ -114,7 +114,20 @@ func (p *Project) DefaultPrivateKey() (path string, err error) {
// Host implements core.Project
func (p *Project) Host() (host core.Host, err error) {
return p.basis.Host()
if host, err = p.basis.Host(); err != nil {
return
}
if s, ok := host.(core.Seeder); ok {
list, err := s.Seeds()
if err != nil {
return nil, err
}
list = append(list, p)
if err = s.Seed(list...); err != nil {
return nil, err
}
}
return
}
// MachineIndex implements core.Project

View File

@ -12,7 +12,7 @@ module VagrantPlugins
default_args = [
# Always get the state bag for host capabilities
SDK::FuncSpec::Value.new(
type: "hashicorp.vagrant.sdk.Args.StateBag",
type: "hashicorp.vagrant.sdk.Args.Project",
name: "",
),
]