Skip to content

Commit

Permalink
provisioner_utils: fix getCommunicator to allow stable ssh connection…
Browse files Browse the repository at this point in the history
…s (like remote-exec provisioner)
  • Loading branch information
akurz committed Aug 30, 2018
1 parent 441941b commit 5d4e76e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion chefsolo/provisioner_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ func getCommunicator(ctx context.Context, o terraform.UIOutput, s *terraform.Ins
if err != nil {
return nil, err
}
defer comm.Disconnect()

// Wait for the context to end and then disconnect
go func() {
<-ctx.Done()
comm.Disconnect()
}()

return comm, err
}

0 comments on commit 5d4e76e

Please sign in to comment.