From 51f55dda48b9c6188c451091989fa23e47a76f11 Mon Sep 17 00:00:00 2001 From: Chris Farmiloe Date: Tue, 12 Aug 2014 18:11:27 +0200 Subject: [PATCH] fix panic when vagrant cloud response fails --- post-processor/vagrant-cloud/step_verify_box.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/post-processor/vagrant-cloud/step_verify_box.go b/post-processor/vagrant-cloud/step_verify_box.go index bbbc3b4b7..cc3f48b85 100644 --- a/post-processor/vagrant-cloud/step_verify_box.go +++ b/post-processor/vagrant-cloud/step_verify_box.go @@ -33,7 +33,12 @@ func (s *stepVerifyBox) Run(state multistep.StateBag) multistep.StepAction { path := fmt.Sprintf("box/%s", config.Tag) resp, err := client.Get(path) - if err != nil || (resp.StatusCode != 200) { + if err != nil { + state.Put("error", fmt.Errorf("Error retrieving box: %s", err)) + return multistep.ActionHalt + } + + if resp.StatusCode != 200 { cloudErrors := &VagrantCloudErrors{} err = decodeBody(resp, cloudErrors) state.Put("error", fmt.Errorf("Error retrieving box: %s", cloudErrors.FormatErrors()))