Merge pull request #1371 from alevkin/master

post-processor/vagrant: Change creating boxes for customizing metadata.json
This commit is contained in:
Mitchell Hashimoto 2014-09-02 09:53:06 -07:00
commit 986394292f
1 changed files with 10 additions and 7 deletions

View File

@ -130,6 +130,7 @@ func DirToBox(dst, dir string, ui packer.Ui, level int) error {
// WriteMetadata writes the "metadata.json" file for a Vagrant box.
func WriteMetadata(dir string, contents interface{}) error {
if _, err := os.Stat(filepath.Join(dir, "metadata.json")); os.IsNotExist(err) {
f, err := os.Create(filepath.Join(dir, "metadata.json"))
if err != nil {
return err
@ -138,4 +139,6 @@ func WriteMetadata(dir string, contents interface{}) error {
enc := json.NewEncoder(f)
return enc.Encode(contents)
}
return nil
}