github.com/aclaygray/packer@v1.3.2/post-processor/vagrant/vmware.go (about)

     1  package vagrant
     2  
     3  import (
     4  	"fmt"
     5  	"path/filepath"
     6  
     7  	"github.com/hashicorp/packer/packer"
     8  )
     9  
    10  type VMwareProvider struct{}
    11  
    12  func (p *VMwareProvider) KeepInputArtifact() bool {
    13  	return false
    14  }
    15  
    16  func (p *VMwareProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) {
    17  	// Create the metadata
    18  	metadata = map[string]interface{}{"provider": "vmware_desktop"}
    19  
    20  	// Copy all of the original contents into the temporary directory
    21  	for _, path := range artifact.Files() {
    22  		ui.Message(fmt.Sprintf("Copying: %s", path))
    23  
    24  		dstPath := filepath.Join(dir, filepath.Base(path))
    25  		if err = CopyContents(dstPath, path); err != nil {
    26  			return
    27  		}
    28  	}
    29  
    30  	return
    31  }