From 1c1ccc1191aee24f2da5245ce9b51ac515afd96a Mon Sep 17 00:00:00 2001 From: Jake Champlin Date: Tue, 27 Oct 2015 10:12:41 -0400 Subject: [PATCH] Use Units of measure in file size Use units of measure, and convert file size to MB with atlas post processor --- post-processor/atlas/post-processor.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/post-processor/atlas/post-processor.go b/post-processor/atlas/post-processor.go index 029fcffe6..7e6220c2f 100644 --- a/post-processor/atlas/post-processor.go +++ b/post-processor/atlas/post-processor.go @@ -204,7 +204,8 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac 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 doneCh := make(chan struct{}) errCh := make(chan error, 1) @@ -220,7 +221,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac select { 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: }