packer-cn/post-processor/vagrant/artifact.go

45 lines
690 B
Go
Raw Normal View History

package vagrant
import (
"fmt"
"os"
)
const BuilderId = "mitchellh.post-processor.vagrant"
type Artifact struct {
2013-06-26 22:09:39 -04:00
Path string
Provider string
}
func NewArtifact(provider, path string) *Artifact {
return &Artifact{
2013-06-26 22:09:39 -04:00
Path: path,
Provider: provider,
}
}
func (*Artifact) BuilderId() string {
return BuilderId
}
func (a *Artifact) Files() []string {
return []string{a.Path}
}
func (a *Artifact) Id() string {
return a.Provider
}
func (a *Artifact) String() string {
return fmt.Sprintf("'%s' provider box: %s", a.Provider, a.Path)
}
func (a *Artifact) State(name string) interface{} {
return nil
}
func (a *Artifact) Destroy() error {
return os.Remove(a.Path)
}