2015-09-02 06:29:26 -04:00
|
|
|
package shell_local
|
|
|
|
|
|
|
|
import (
|
2018-02-23 16:26:31 -05:00
|
|
|
sl "github.com/hashicorp/packer/common/shell-local"
|
2017-04-04 16:39:01 -04:00
|
|
|
"github.com/hashicorp/packer/packer"
|
2015-09-02 06:29:26 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type PostProcessor struct {
|
2018-02-27 15:50:42 -05:00
|
|
|
config sl.Config
|
2015-09-02 06:29:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type ExecuteCommandTemplate struct {
|
2016-11-21 08:39:34 -05:00
|
|
|
Vars string
|
|
|
|
Script string
|
2015-09-02 06:29:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
2018-02-28 17:35:42 -05:00
|
|
|
err := sl.Decode(&p.config, raws...)
|
2015-09-02 06:29:26 -04:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2018-02-27 15:50:42 -05:00
|
|
|
return sl.Validate(&p.config)
|
2015-09-02 06:29:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, error) {
|
2018-02-28 14:53:53 -05:00
|
|
|
// this particular post-processor doesn't do anything with the artifact
|
|
|
|
// except to return it.
|
2015-09-02 06:29:26 -04:00
|
|
|
|
2018-02-28 14:53:53 -05:00
|
|
|
retBool, retErr := sl.Run(ui, &p.config)
|
|
|
|
if !retBool {
|
|
|
|
return nil, retBool, retErr
|
2017-01-23 17:15:51 -05:00
|
|
|
}
|
|
|
|
|
2018-02-28 14:53:53 -05:00
|
|
|
return artifact, retBool, retErr
|
2017-01-23 17:15:51 -05:00
|
|
|
}
|