Ensure config is set on basis/project during init

This commit is contained in:
Chris Roberts 2022-07-08 10:08:11 -07:00
parent df42e88aab
commit 766b951040
2 changed files with 18 additions and 0 deletions

View File

@ -137,6 +137,15 @@ func (b *Basis) Init() error {
}
}
// If our reloaded data does not include any configuration
// stub in a default value
if b.basis.Configuration == nil {
b.basis.Configuration = &vagrant_server.Vagrantfile{
Unfinalized: &vagrant_plugin_sdk.Args_Hash{},
Format: vagrant_server.Vagrantfile_RUBY,
}
}
// If the basis directory is unset, set it
if b.dir == nil {
if b.dir, err = datadir.NewBasis(b.basis.Name); err != nil {

View File

@ -118,6 +118,15 @@ func (p *Project) Init() error {
}
}
// If our reloaded data does not include any configuration
// stub in a default value
if p.project.Configuration == nil {
p.project.Configuration = &vagrant_server.Vagrantfile{
Unfinalized: &vagrant_plugin_sdk.Args_Hash{},
Format: vagrant_server.Vagrantfile_RUBY,
}
}
// If we don't have a basis set, load it
if p.basis == nil {
p.basis, err = p.factory.NewBasis(p.project.Basis.ResourceId, WithBasisRef(p.project.Basis))