From 2de91e48627ccbe8b7c043f6bdfc438f0b8e4919 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 24 Mar 2021 10:52:56 -0700 Subject: [PATCH] Check configuration before running callback for upload confirmation --- post-processor/vagrant-cloud/step_confirm_upload.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/post-processor/vagrant-cloud/step_confirm_upload.go b/post-processor/vagrant-cloud/step_confirm_upload.go index fcb8e02ca..a177ecbcd 100644 --- a/post-processor/vagrant-cloud/step_confirm_upload.go +++ b/post-processor/vagrant-cloud/step_confirm_upload.go @@ -16,6 +16,11 @@ func (s *stepConfirmUpload) Run(ctx context.Context, state multistep.StateBag) m ui := state.Get("ui").(packersdk.Ui) upload := state.Get("upload").(*Upload) url := upload.CallbackPath + config := state.Get("config").(*Config) + + if config.NoDirectUpload { + return multistep.ActionContinue + } ui.Say("Confirming direct box upload completion") @@ -23,7 +28,7 @@ func (s *stepConfirmUpload) Run(ctx context.Context, state multistep.StateBag) m if err != nil || resp.StatusCode != 200 { if resp == nil || resp.Body == nil { - state.Put("error", "No response from server.") + state.Put("error", fmt.Errorf("No response from server.")) } else { cloudErrors := &VagrantCloudErrors{} err = decodeBody(resp, cloudErrors)