2014-04-26 12:22:10 -04:00
|
|
|
package compress
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
2015-06-10 17:04:24 -04:00
|
|
|
const BuilderId = "packer.post-processor.compress"
|
2014-04-26 12:22:10 -04:00
|
|
|
|
|
|
|
type Artifact struct {
|
2015-06-10 15:30:18 -04:00
|
|
|
builderId string
|
|
|
|
dir string
|
|
|
|
f []string
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 15:30:18 -04:00
|
|
|
func (a *Artifact) BuilderId() string {
|
2014-04-26 12:22:10 -04:00
|
|
|
return BuilderId
|
|
|
|
}
|
|
|
|
|
2015-06-10 15:30:18 -04:00
|
|
|
func (a *Artifact) Files() []string {
|
|
|
|
return a.f
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 15:30:18 -04:00
|
|
|
func (*Artifact) Id() string {
|
|
|
|
return "COMPRESS"
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 15:30:18 -04:00
|
|
|
func (a *Artifact) String() string {
|
|
|
|
return fmt.Sprintf("VM compressed files in directory: %s", a.dir)
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|
|
|
|
|
2014-01-19 13:32:44 -05:00
|
|
|
func (*Artifact) State(name string) interface{} {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-06-10 15:30:18 -04:00
|
|
|
func (a *Artifact) Destroy() error {
|
|
|
|
return os.RemoveAll(a.dir)
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|