github.com/phobos182/packer@v0.2.3-0.20130819023704-c84d2aeffc68/builder/amazon/chroot/step_chroot_provision.go (about)

     1  package chroot
     2  
     3  import (
     4  	"github.com/mitchellh/multistep"
     5  	"github.com/mitchellh/packer/packer"
     6  	"log"
     7  )
     8  
     9  // StepChrootProvision provisions the instance within a chroot.
    10  type StepChrootProvision struct {
    11  	mounts []string
    12  }
    13  
    14  func (s *StepChrootProvision) Run(state map[string]interface{}) multistep.StepAction {
    15  	hook := state["hook"].(packer.Hook)
    16  	mountPath := state["mount_path"].(string)
    17  	ui := state["ui"].(packer.Ui)
    18  
    19  	// Create our communicator
    20  	comm := &Communicator{
    21  		Chroot: mountPath,
    22  	}
    23  
    24  	// Provision
    25  	log.Println("Running the provision hook")
    26  	if err := hook.Run(packer.HookProvision, ui, comm, nil); err != nil {
    27  		state["error"] = err
    28  		return multistep.ActionHalt
    29  	}
    30  
    31  	return multistep.ActionContinue
    32  }
    33  
    34  func (s *StepChrootProvision) Cleanup(state map[string]interface{}) {}