post-processor/vagrant-cloud: fix dropped errors

This commit is contained in:
Lars Lehtonen 2019-09-25 16:58:26 -07:00
parent e4e70f80ae
commit 21f2e67462
No known key found for this signature in database
GPG Key ID: 8137D474EBCB04F2
5 changed files with 15 additions and 0 deletions

View File

@ -145,6 +145,9 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact
// Determine the name of the provider for Vagrant Cloud, and Vagrant
providerName, err := getProvider(artifact.Id(), artifact.Files()[0], builtins[artifact.BuilderId()])
if err != nil {
return nil, false, false, fmt.Errorf("error getting provider name: %s", err)
}
p.config.ctx.Data = &boxDownloadUrlTemplate{
ArtifactId: artifact.Id(),

View File

@ -46,6 +46,9 @@ func (s *stepCreateProvider) Run(ctx context.Context, state multistep.StateBag)
if err != nil || (resp.StatusCode != 200) {
cloudErrors := &VagrantCloudErrors{}
err = decodeBody(resp, cloudErrors)
if err != nil {
ui.Error(fmt.Sprintf("error decoding error response: %s", err))
}
state.Put("error", fmt.Errorf("Error creating provider: %s", cloudErrors.FormatErrors()))
return multistep.ActionHalt
}

View File

@ -43,6 +43,9 @@ func (s *stepCreateVersion) Run(ctx context.Context, state multistep.StateBag) m
if err != nil || (resp.StatusCode != 200) {
cloudErrors := &VagrantCloudErrors{}
err = decodeBody(resp, cloudErrors)
if err != nil {
ui.Error(fmt.Sprintf("error decoding error response: %s", err))
}
state.Put("error", fmt.Errorf("Error creating version: %s", cloudErrors.FormatErrors()))
return multistep.ActionHalt
}

View File

@ -36,6 +36,9 @@ func (s *stepPrepareUpload) Run(ctx context.Context, state multistep.StateBag) m
} else {
cloudErrors := &VagrantCloudErrors{}
err = decodeBody(resp, cloudErrors)
if err != nil {
ui.Error(fmt.Sprintf("error decoding error response: %s", err))
}
state.Put("error", fmt.Errorf("Error preparing upload: %s", cloudErrors.FormatErrors()))
}
return multistep.ActionHalt

View File

@ -43,6 +43,9 @@ func (s *stepVerifyBox) Run(ctx context.Context, state multistep.StateBag) multi
if resp.StatusCode != 200 {
cloudErrors := &VagrantCloudErrors{}
err = decodeBody(resp, cloudErrors)
if err != nil {
ui.Error(fmt.Sprintf("error decoding error response: %s", err))
}
state.Put("error", fmt.Errorf("Error retrieving box: %s", cloudErrors.FormatErrors()))
return multistep.ActionHalt
}