From 5692294a96db6d3a843b1caa14ddae852da0ae6e Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Mon, 4 Nov 2019 15:15:37 -0800 Subject: [PATCH] use absolute path for vagrantfile to avoid confusion with build directory later --- builder/vagrant/builder.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builder/vagrant/builder.go b/builder/vagrant/builder.go index a922ed017..5fb189e13 100644 --- a/builder/vagrant/builder.go +++ b/builder/vagrant/builder.go @@ -184,6 +184,14 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { } } + if b.config.OutputVagrantfile != "" { + b.config.OutputVagrantfile, err = filepath.Abs(b.config.OutputVagrantfile) + if err != nil { + packer.MultiErrorAppend(errs, + fmt.Errorf("unable to determine absolute path for output vagrantfile: %s", err)) + } + } + if b.config.TeardownMethod == "" { // If we're using a box that's already opened on the system, don't // automatically destroy it. If we open the box ourselves, then go ahead