|
|
|
|
@ -45,6 +45,8 @@ type StepConnect struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *StepConnect) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
|
|
|
|
ui := state.Get("ui").(packer.Ui)
|
|
|
|
|
|
|
|
|
|
typeMap := map[string]multistep.Step{
|
|
|
|
|
"none": nil,
|
|
|
|
|
"ssh": &StepConnectSSH{
|
|
|
|
|
@ -71,19 +73,26 @@ func (s *StepConnect) Run(ctx context.Context, state multistep.StateBag) multist
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if step == nil {
|
|
|
|
|
comm, err := none.New("none")
|
|
|
|
|
if err != nil {
|
|
|
|
|
if comm, err := none.New("none"); err != nil {
|
|
|
|
|
err := fmt.Errorf("Failed to set communicator 'none': %s", err)
|
|
|
|
|
state.Put("error", err)
|
|
|
|
|
ui := state.Get("ui").(packer.Ui)
|
|
|
|
|
ui.Error(err.Error())
|
|
|
|
|
return multistep.ActionHalt
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
state.Put("communicator", comm)
|
|
|
|
|
log.Printf("[INFO] communicator disabled, will not connect")
|
|
|
|
|
}
|
|
|
|
|
state.Put("communicator", comm)
|
|
|
|
|
log.Printf("[INFO] communicator disabled, will not connect")
|
|
|
|
|
return multistep.ActionContinue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if host, err := s.Host(state); err == nil {
|
|
|
|
|
ui.Say(fmt.Sprintf("Using %s communicator to connect: %s", s.Config.Type, host))
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
log.Printf("[DEBUG] Unable to get address during connection step: %s", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s.substep = step
|
|
|
|
|
return s.substep.Run(ctx, state)
|
|
|
|
|
}
|
|
|
|
|
|