post-processor/vagrant: show file being compressed [GH-314]
This commit is contained in:
parent
1be6563e4c
commit
faf6eb1c67
|
@ -1,6 +1,9 @@
|
|||
## 0.3.4 (unreleased)
|
||||
|
||||
IMPROVEMENTS:
|
||||
|
||||
* post-processor/vagrant: the file being compressed will be shown
|
||||
in the UI [GH-314]
|
||||
|
||||
## 0.3.3 (August 19, 2013)
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ func (p *AWSBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact
|
|||
}
|
||||
|
||||
// Compress the directory to the given output path
|
||||
if err := DirToBox(outputPath, dir); err != nil {
|
||||
if err := DirToBox(outputPath, dir, ui); err != nil {
|
||||
err = fmt.Errorf("error creating box: %s", err)
|
||||
return nil, false, err
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"archive/tar"
|
||||
"compress/gzip"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
|
@ -42,7 +44,7 @@ func CopyContents(dst, src string) error {
|
|||
// DirToBox takes the directory and compresses it into a Vagrant-compatible
|
||||
// box. This function does not perform checks to verify that dir is
|
||||
// actually a proper box. This is an expected precondition.
|
||||
func DirToBox(dst, dir string) error {
|
||||
func DirToBox(dst, dir string, ui packer.Ui) error {
|
||||
log.Printf("Turning dir into box: %s => %s", dir, dst)
|
||||
dstF, err := os.Create(dst)
|
||||
if err != nil {
|
||||
|
@ -90,6 +92,10 @@ func DirToBox(dst, dir string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if ui != nil {
|
||||
ui.Message(fmt.Sprintf("Compressing: %s", header.Name))
|
||||
}
|
||||
|
||||
if err := tarWriter.WriteHeader(header); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ func (p *VBoxBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifac
|
|||
|
||||
// Compress the directory to the given output path
|
||||
ui.Message(fmt.Sprintf("Compressing box..."))
|
||||
if err := DirToBox(outputPath, dir); err != nil {
|
||||
if err := DirToBox(outputPath, dir, ui); err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ func (p *VMwareBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artif
|
|||
|
||||
// Compress the directory to the given output path
|
||||
ui.Message(fmt.Sprintf("Compressing box..."))
|
||||
if err := DirToBox(outputPath, dir); err != nil {
|
||||
if err := DirToBox(outputPath, dir, ui); err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue