Files
Packer-Cn/builder/amazon/chroot/step_chroot_provision.go
T

37 lines
898 B
Go
Raw Normal View History

package chroot
import (
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"log"
)
// StepChrootProvision provisions the instance within a chroot.
type StepChrootProvision struct {
mounts []string
}
2013-08-31 12:58:55 -07:00
func (s *StepChrootProvision) Run(state multistep.StateBag) multistep.StepAction {
hook := state.Get("hook").(packer.Hook)
mountPath := state.Get("mount_path").(string)
ui := state.Get("ui").(packer.Ui)
2013-09-30 09:33:57 -07:00
wrappedCommand := state.Get("wrappedCommand").(CommandWrapper)
// Create our communicator
comm := &Communicator{
2013-09-30 09:33:57 -07:00
Chroot: mountPath,
CmdWrapper: wrappedCommand,
}
// Provision
log.Println("Running the provision hook")
if err := hook.Run(packer.HookProvision, ui, comm, nil); err != nil {
2013-08-31 12:58:55 -07:00
state.Put("error", err)
return multistep.ActionHalt
}
return multistep.ActionContinue
}
2013-08-31 12:58:55 -07:00
func (s *StepChrootProvision) Cleanup(state multistep.StateBag) {}