Merge pull request #8156 from alrs/fix-post-processor-vagrant-cloud-errors

post-processor/vagrant-cloud: fix dropped errors
This commit is contained in:
Adrien Delorme 2019-09-27 10:27:48 +02:00 committed by GitHub
commit d730aabf41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 // Determine the name of the provider for Vagrant Cloud, and Vagrant
providerName, err := getProvider(artifact.Id(), artifact.Files()[0], builtins[artifact.BuilderId()]) 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{ p.config.ctx.Data = &boxDownloadUrlTemplate{
ArtifactId: artifact.Id(), 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) { if err != nil || (resp.StatusCode != 200) {
cloudErrors := &VagrantCloudErrors{} cloudErrors := &VagrantCloudErrors{}
err = decodeBody(resp, cloudErrors) 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())) state.Put("error", fmt.Errorf("Error creating provider: %s", cloudErrors.FormatErrors()))
return multistep.ActionHalt 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) { if err != nil || (resp.StatusCode != 200) {
cloudErrors := &VagrantCloudErrors{} cloudErrors := &VagrantCloudErrors{}
err = decodeBody(resp, cloudErrors) 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())) state.Put("error", fmt.Errorf("Error creating version: %s", cloudErrors.FormatErrors()))
return multistep.ActionHalt return multistep.ActionHalt
} }

View File

@ -36,6 +36,9 @@ func (s *stepPrepareUpload) Run(ctx context.Context, state multistep.StateBag) m
} else { } else {
cloudErrors := &VagrantCloudErrors{} cloudErrors := &VagrantCloudErrors{}
err = decodeBody(resp, cloudErrors) 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())) state.Put("error", fmt.Errorf("Error preparing upload: %s", cloudErrors.FormatErrors()))
} }
return multistep.ActionHalt return multistep.ActionHalt

View File

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