Commit c0d69020 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

post-processor/vagrant: Only tar files

parent e5a23492
...@@ -31,7 +31,7 @@ const defaultConfig = ` ...@@ -31,7 +31,7 @@ const defaultConfig = `
}, },
"post-processors": { "post-processors": {
"compress": "packer-post-processor-compress" "vagrant": "packer-post-processor-vagrant"
}, },
"provisioners": { "provisioners": {
......
...@@ -40,6 +40,8 @@ func (p *PostProcessor) Configure(raw interface{}) error { ...@@ -40,6 +40,8 @@ func (p *PostProcessor) Configure(raw interface{}) error {
return fmt.Errorf("output invalid template: %s", err) return fmt.Errorf("output invalid template: %s", err)
} }
/*
TODO(mitchellh): We need a way to get the keys...
mapConfig, ok := raw.(map[string]interface{}) mapConfig, ok := raw.(map[string]interface{})
if !ok { if !ok {
panic("Raw configuration not a map") panic("Raw configuration not a map")
...@@ -62,6 +64,7 @@ func (p *PostProcessor) Configure(raw interface{}) error { ...@@ -62,6 +64,7 @@ func (p *PostProcessor) Configure(raw interface{}) error {
if len(errors) > 0 { if len(errors) > 0 {
return &packer.MultiError{errors} return &packer.MultiError{errors}
} }
*/
return nil return nil
} }
......
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
"encoding/json" "encoding/json"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"io" "io"
"log"
"os" "os"
"path/filepath" "path/filepath"
"text/template" "text/template"
...@@ -23,6 +24,7 @@ type OutputPathTemplate struct { ...@@ -23,6 +24,7 @@ type OutputPathTemplate struct {
// box. This function does not perform checks to verify that dir is // box. This function does not perform checks to verify that dir is
// actually a proper box. This is an expected precondition. // actually a proper box. This is an expected precondition.
func DirToBox(dst, dir string) error { func DirToBox(dst, dir string) error {
log.Printf("Turning dir into box: %s", dir)
dstF, err := os.Create(dst) dstF, err := os.Create(dst)
if err != nil { if err != nil {
return err return err
...@@ -37,6 +39,13 @@ func DirToBox(dst, dir string) error { ...@@ -37,6 +39,13 @@ func DirToBox(dst, dir string) error {
// This is the walk func that tars each of the files in the dir // This is the walk func that tars each of the files in the dir
tarWalk := func(path string, info os.FileInfo, prevErr error) error { tarWalk := func(path string, info os.FileInfo, prevErr error) error {
// Skip directories
if info.IsDir() {
log.Printf("Skiping directory '%s' for box '%s'", path, dst)
return nil
}
log.Printf("Box add: '%s' to '%s'", path, dst)
f, err := os.Open(path) f, err := os.Open(path)
if err != nil { if err != nil {
return err return err
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment