Use Units of measure in file size
Use units of measure, and convert file size to MB with atlas post processor
This commit is contained in:
parent
0b6d303e65
commit
1c1ccc1191
|
@ -204,7 +204,8 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
||||||
opts.FileSize = r.Size
|
opts.FileSize = r.Size
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.Message(fmt.Sprintf("Uploading artifact (Size: %v)", opts.FileSize))
|
fileSizeMB := float64(opts.FileSize / 1000000)
|
||||||
|
ui.Message(fmt.Sprintf("Uploading artifact (Size: %.2fMB)", fileSizeMB))
|
||||||
var av *atlas.ArtifactVersion
|
var av *atlas.ArtifactVersion
|
||||||
doneCh := make(chan struct{})
|
doneCh := make(chan struct{})
|
||||||
errCh := make(chan error, 1)
|
errCh := make(chan error, 1)
|
||||||
|
@ -220,7 +221,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case err := <-errCh:
|
case err := <-errCh:
|
||||||
return nil, false, fmt.Errorf("Error uploading (Size: %v): %s", opts.FileSize, err)
|
return nil, false, fmt.Errorf("Error uploading (Size: %.2fMB): %s", fileSizeMB, err)
|
||||||
case <-doneCh:
|
case <-doneCh:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue