Merge pull request #1411 from chrisfarms/master

fix panic when vagrant cloud response fails
This commit is contained in:
Jack Pearkes 2014-08-19 12:25:12 -07:00
commit 895db383c8
1 changed files with 6 additions and 1 deletions

View File

@ -33,7 +33,12 @@ func (s *stepVerifyBox) Run(state multistep.StateBag) multistep.StepAction {
path := fmt.Sprintf("box/%s", config.Tag) path := fmt.Sprintf("box/%s", config.Tag)
resp, err := client.Get(path) 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{} cloudErrors := &VagrantCloudErrors{}
err = decodeBody(resp, cloudErrors) err = decodeBody(resp, cloudErrors)
state.Put("error", fmt.Errorf("Error retrieving box: %s", cloudErrors.FormatErrors())) state.Put("error", fmt.Errorf("Error retrieving box: %s", cloudErrors.FormatErrors()))