Merge pull request #7859 from hashicorp/vagrant_box_name
use box_name instead of source_path when generating vagrant file
This commit is contained in:
commit
7b13eac1d7
|
@ -199,7 +199,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
&StepCreateVagrantfile{
|
&StepCreateVagrantfile{
|
||||||
Template: b.config.Template,
|
Template: b.config.Template,
|
||||||
SyncedFolder: b.config.SyncedFolder,
|
SyncedFolder: b.config.SyncedFolder,
|
||||||
SourceBox: b.config.SourceBox,
|
BoxName: b.config.BoxName,
|
||||||
OutputDir: b.config.OutputDir,
|
OutputDir: b.config.OutputDir,
|
||||||
GlobalID: b.config.GlobalID,
|
GlobalID: b.config.GlobalID,
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,10 +14,10 @@ import (
|
||||||
|
|
||||||
type StepCreateVagrantfile struct {
|
type StepCreateVagrantfile struct {
|
||||||
Template string
|
Template string
|
||||||
SourceBox string
|
|
||||||
OutputDir string
|
OutputDir string
|
||||||
SyncedFolder string
|
SyncedFolder string
|
||||||
GlobalID string
|
GlobalID string
|
||||||
|
BoxName string
|
||||||
}
|
}
|
||||||
|
|
||||||
var DEFAULT_TEMPLATE = `Vagrant.configure("2") do |config|
|
var DEFAULT_TEMPLATE = `Vagrant.configure("2") do |config|
|
||||||
|
@ -56,7 +56,7 @@ func (s *StepCreateVagrantfile) createVagrantfile() (string, error) {
|
||||||
|
|
||||||
opts := &VagrantfileOptions{
|
opts := &VagrantfileOptions{
|
||||||
SyncedFolder: s.SyncedFolder,
|
SyncedFolder: s.SyncedFolder,
|
||||||
BoxName: s.SourceBox,
|
BoxName: s.BoxName,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tpl.Execute(templateFile, opts)
|
err = tpl.Execute(templateFile, opts)
|
||||||
|
|
|
@ -20,7 +20,7 @@ func TestStepCreateVagrantfile_Impl(t *testing.T) {
|
||||||
func TestCreateFile(t *testing.T) {
|
func TestCreateFile(t *testing.T) {
|
||||||
testy := StepCreateVagrantfile{
|
testy := StepCreateVagrantfile{
|
||||||
OutputDir: "./",
|
OutputDir: "./",
|
||||||
SourceBox: "bananas",
|
BoxName: "bananas",
|
||||||
}
|
}
|
||||||
templatePath, err := testy.createVagrantfile()
|
templatePath, err := testy.createVagrantfile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue