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 {
|
2017-03-28 21:02:51 -04:00
|
|
|
Path 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-12 20:25:09 -04:00
|
|
|
func (*Artifact) Id() string {
|
|
|
|
return ""
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|
|
|
|
|
2015-06-12 20:25:09 -04:00
|
|
|
func (a *Artifact) Files() []string {
|
2015-06-18 08:13:48 -04:00
|
|
|
return []string{a.Path}
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 15:30:18 -04:00
|
|
|
func (a *Artifact) String() string {
|
2016-05-08 07:11:54 -04:00
|
|
|
return fmt.Sprintf("compressed artifacts in: %s", a.Path)
|
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 {
|
2015-06-12 20:25:09 -04:00
|
|
|
return os.Remove(a.Path)
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|