diff options
Diffstat (limited to 'vendor/github.com/mitchellh/packer/builder/lxd/step_provision.go')
-rw-r--r-- | vendor/github.com/mitchellh/packer/builder/lxd/step_provision.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/mitchellh/packer/builder/lxd/step_provision.go b/vendor/github.com/mitchellh/packer/builder/lxd/step_provision.go new file mode 100644 index 00000000..c46b900e --- /dev/null +++ b/vendor/github.com/mitchellh/packer/builder/lxd/step_provision.go @@ -0,0 +1,34 @@ +package lxd + +import ( + "github.com/hashicorp/packer/packer" + "github.com/mitchellh/multistep" + "log" +) + +// StepProvision provisions the container +type StepProvision struct{} + +func (s *StepProvision) Run(state multistep.StateBag) multistep.StepAction { + hook := state.Get("hook").(packer.Hook) + config := state.Get("config").(*Config) + ui := state.Get("ui").(packer.Ui) + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + + // Create our communicator + comm := &Communicator{ + ContainerName: config.ContainerName, + CmdWrapper: wrappedCommand, + } + + // Provision + log.Println("Running the provision hook") + if err := hook.Run(packer.HookProvision, ui, comm, nil); err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *StepProvision) Cleanup(state multistep.StateBag) {} |