From 766b9510401afc3b85f7447bac91e9f4d48c0aa2 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Fri, 8 Jul 2022 10:08:11 -0700 Subject: [PATCH] Ensure config is set on basis/project during init --- internal/core/basis.go | 9 +++++++++ internal/core/project.go | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/internal/core/basis.go b/internal/core/basis.go index ce42ff18f..30458afee 100644 --- a/internal/core/basis.go +++ b/internal/core/basis.go @@ -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 { diff --git a/internal/core/project.go b/internal/core/project.go index 3c600240e..96bf290fa 100644 --- a/internal/core/project.go +++ b/internal/core/project.go @@ -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))