Adjust upload limit value and fix error value stored in state bag

This commit is contained in:
Chris Roberts 2021-03-24 10:51:10 -07:00
parent 9b641c9bfd
commit 3a11820a41
1 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@ import (
packersdk "github.com/hashicorp/packer-plugin-sdk/packer" packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
) )
const VAGRANT_CLOUD_DIRECT_UPLOAD_LIMIT = 5000000000 // Upload limit is 5GB const VAGRANT_CLOUD_DIRECT_UPLOAD_LIMIT = 5368709120 // Upload limit is 5G
type Upload struct { type Upload struct {
UploadPath string `json:"upload_path"` UploadPath string `json:"upload_path"`
@ -52,7 +52,7 @@ func (s *stepPrepareUpload) Run(ctx context.Context, state multistep.StateBag) m
if err != nil || (resp.StatusCode != 200) { if err != nil || (resp.StatusCode != 200) {
if resp == nil || resp.Body == nil { if resp == nil || resp.Body == nil {
state.Put("error", "No response from server.") state.Put("error", fmt.Errorf("No response from server."))
} else { } else {
cloudErrors := &VagrantCloudErrors{} cloudErrors := &VagrantCloudErrors{}
err = decodeBody(resp, cloudErrors) err = decodeBody(resp, cloudErrors)