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

     1  package vagrant
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  )
     7  
     8  const BuilderId = "mitchellh.post-processor.vagrant"
     9  
    10  type Artifact struct {
    11  	Path     string
    12  	Provider string
    13  }
    14  
    15  func NewArtifact(provider, path string) *Artifact {
    16  	return &Artifact{
    17  		Path:     path,
    18  		Provider: provider,
    19  	}
    20  }
    21  
    22  func (*Artifact) BuilderId() string {
    23  	return BuilderId
    24  }
    25  
    26  func (a *Artifact) Files() []string {
    27  	return []string{a.Path}
    28  }
    29  
    30  func (a *Artifact) Id() string {
    31  	return a.Provider
    32  }
    33  
    34  func (a *Artifact) String() string {
    35  	return fmt.Sprintf("'%s' provider box: %s", a.Provider, a.Path)
    36  }
    37  
    38  func (a *Artifact) State(name string) interface{} {
    39  	return nil
    40  }
    41  
    42  func (a *Artifact) Destroy() error {
    43  	return os.Remove(a.Path)
    44  }