Merge pull request #1371 from alevkin/master
post-processor/vagrant: Change creating boxes for customizing metadata.json
This commit is contained in:
commit
986394292f
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue