예제 #1
0
// BuildImage required by builder.ImageBuilder.
//TODO(illia)implement sending notification during building process with current output
func (p *Packer) BuildImage() error {
	p.notifier.Notify("packer", "building", "")
	artifacts, err := builder.RunCommand(p.workingDirectory,
		p.executionCommand,
		"build_image",
		p.buildPackerVars("build", p.templatePath),
	)
	p.artifacts = append(p.artifacts, artifacts...)
	p.notifier.Notify("packer", "finished", "")
	return err
}
예제 #2
0
// Validate required by builder.ImageBuilder.
func (p *Packer) Validate() error {
	//like this [ash2] illia_svyrydov@b0f007ash2012:~/packer$ ./packer validate templates/base-ubuntu-14.04-openstack.json
	//Template validated successfully.
	p.notifier.Notify("packer", "validation", fmt.Sprintf("%s", p))
	artifacts, err := builder.RunCommand(p.workingDirectory,
		p.executionCommand,
		"template_validation",
		[]string{"validate", p.templatePath},
	)
	p.artifacts = append(p.artifacts, artifacts...)
	p.notifier.Notify("packer", "validated", fmt.Sprintf("%s", p))
	return err
}