2013-06-26 21:55:11 -04:00
|
|
|
package vagrant
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
const BuilderId = "mitchellh.post-processor.vagrant"
|
|
|
|
|
|
|
|
type Artifact struct {
|
2013-06-26 22:09:39 -04:00
|
|
|
Path string
|
2013-06-26 21:55:11 -04:00
|
|
|
Provider string
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewArtifact(provider, path string) *Artifact {
|
|
|
|
return &Artifact{
|
2013-06-26 22:09:39 -04:00
|
|
|
Path: path,
|
2013-06-26 21:55:11 -04:00
|
|
|
Provider: provider,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*Artifact) BuilderId() string {
|
|
|
|
return BuilderId
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Files() []string {
|
|
|
|
return []string{a.Path}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Id() string {
|
2014-06-16 15:53:37 -04:00
|
|
|
return a.Provider
|
2013-06-26 21:55:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) String() string {
|
|
|
|
return fmt.Sprintf("'%s' provider box: %s", a.Provider, a.Path)
|
|
|
|
}
|
|
|
|
|
2014-01-19 13:32:44 -05:00
|
|
|
func (a *Artifact) State(name string) interface{} {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2013-06-26 21:55:11 -04:00
|
|
|
func (a *Artifact) Destroy() error {
|
|
|
|
return os.Remove(a.Path)
|
|
|
|
}
|