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

     1  package vagrant
     2  
     3  import (
     4  	"fmt"
     5  	"path/filepath"
     6  
     7  	"github.com/hashicorp/packer/packer"
     8  )
     9  
    10  type LXCProvider struct{}
    11  
    12  func (p *LXCProvider) KeepInputArtifact() bool {
    13  	return false
    14  }
    15  
    16  func (p *LXCProvider) 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{}{
    19  		"provider": "lxc",
    20  		"version":  "1.0.0",
    21  	}
    22  
    23  	// Copy all of the original contents into the temporary directory
    24  	for _, path := range artifact.Files() {
    25  		ui.Message(fmt.Sprintf("Copying: %s", path))
    26  
    27  		dstPath := filepath.Join(dir, filepath.Base(path))
    28  		if err = CopyContents(dstPath, path); err != nil {
    29  			return
    30  		}
    31  	}
    32  
    33  	return
    34  }