From 9f702af6d9e6a06cc55be282081437a042a3103a Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 14 Feb 2019 14:46:14 -0800 Subject: [PATCH] we lost the skip_add step somewhere --- builder/vagrant/builder.go | 1 + builder/vagrant/step_add_box.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/builder/vagrant/builder.go b/builder/vagrant/builder.go index 469270298..a0cd3202a 100644 --- a/builder/vagrant/builder.go +++ b/builder/vagrant/builder.go @@ -223,6 +223,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe SourceBox: b.config.SourceBox, BoxName: b.config.BoxName, GlobalID: b.config.GlobalID, + SkipAdd: b.config.SkipAdd, }, &StepUp{ TeardownMethod: b.config.TeardownMethod, diff --git a/builder/vagrant/step_add_box.go b/builder/vagrant/step_add_box.go index a1832969e..9c1e23eb6 100644 --- a/builder/vagrant/step_add_box.go +++ b/builder/vagrant/step_add_box.go @@ -21,10 +21,10 @@ type StepAddBox struct { SourceBox string BoxName string GlobalID string + SkipAdd bool } func (s *StepAddBox) generateAddArgs() []string { - addArgs := []string{} if strings.HasSuffix(s.SourceBox, ".box") { @@ -72,6 +72,11 @@ func (s *StepAddBox) Run(_ context.Context, state multistep.StateBag) multistep. driver := state.Get("driver").(VagrantDriver) ui := state.Get("ui").(packer.Ui) + if s.SkipAdd { + ui.Say("skip_add was set so we assume the box is already in Vagrant...") + return multistep.ActionContinue + } + if s.GlobalID != "" { ui.Say("Using a global-id; skipping Vagrant add command...") return multistep.ActionContinue