From 1303329a911e99676158453183b8acb32ca8b337 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Fri, 19 Sep 2014 15:46:07 -0700 Subject: [PATCH] Added struct to be passed to the Process function to render the vagrant file path. Resolves Issue #1125. --- post-processor/vagrant/post-processor.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/post-processor/vagrant/post-processor.go b/post-processor/vagrant/post-processor.go index 8fb486edb..78d6f0158 100644 --- a/post-processor/vagrant/post-processor.go +++ b/post-processor/vagrant/post-processor.go @@ -125,9 +125,17 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac // Write our Vagrantfile var customVagrantfile string if config.VagrantfileTemplate != "" { + vagrantfilePath, err := config.tpl.Process(config.VagrantfileTemplate, &vagrantfileTemplate{ + ProviderVagrantfile: vagrantfile, + CustomVagrantfile: "", + }) + if err != nil { + return nil, false, err + } + ui.Message(fmt.Sprintf( - "Using custom Vagrantfile: %s", config.VagrantfileTemplate)) - customBytes, err := ioutil.ReadFile(config.VagrantfileTemplate) + "Using custom Vagrantfile: %s", vagrantfilePath)) + customBytes, err := ioutil.ReadFile(vagrantfilePath) if err != nil { return nil, false, err }