2019-01-28 06:30:15 -05:00
|
|
|
package hyperone
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2020-12-17 16:29:25 -05:00
|
|
|
"github.com/hashicorp/packer-plugin-sdk/multistep"
|
|
|
|
"github.com/hashicorp/packer-plugin-sdk/multistep/commonsteps"
|
|
|
|
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
|
2019-01-28 06:30:15 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
type stepChrootProvision struct{}
|
|
|
|
|
|
|
|
func (s *stepChrootProvision) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
|
|
|
config := state.Get("config").(*Config)
|
|
|
|
wrappedCommand := state.Get("wrappedCommand").(CommandWrapper)
|
2020-11-19 18:10:00 -05:00
|
|
|
sshCommunicator := state.Get("communicator").(packersdk.Communicator)
|
2019-01-28 06:30:15 -05:00
|
|
|
|
|
|
|
comm := &ChrootCommunicator{
|
|
|
|
Chroot: config.ChrootMountPath,
|
|
|
|
CmdWrapper: wrappedCommand,
|
|
|
|
Wrapped: sshCommunicator,
|
|
|
|
}
|
|
|
|
|
2020-11-11 18:04:28 -05:00
|
|
|
stepProvision := commonsteps.StepProvision{Comm: comm}
|
2019-01-28 06:30:15 -05:00
|
|
|
return stepProvision.Run(ctx, state)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *stepChrootProvision) Cleanup(multistep.StateBag) {}
|