From fd6be7f279dc60190dd758ba44cd5bd1fdbc470d Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 20 Jul 2020 16:02:49 +0200 Subject: [PATCH] better/simpler `pause_before_connecting` example --- helper/communicator/config.go | 41 ++++--------------- .../communicator/Config-not-required.mdx | 41 ++++--------------- 2 files changed, 16 insertions(+), 66 deletions(-) diff --git a/helper/communicator/config.go b/helper/communicator/config.go index cd9160377..88c194660 100644 --- a/helper/communicator/config.go +++ b/helper/communicator/config.go @@ -43,41 +43,16 @@ type Config struct { Type string `mapstructure:"communicator"` // We recommend that you enable SSH or WinRM as the very last step in your - // guest's bootstrap script, but sometimes you may have a race condition where - // you need Packer to wait before attempting to connect to your guest. + // guest's bootstrap script, but sometimes you may have a race condition + // where you need Packer to wait before attempting to connect to your + // guest. // // If you end up in this situation, you can use the template option - // `pause_before_connecting`. By default, there is no pause. For example: - // - // - // - // - // ```json - // "builders" [{ - // ... - // "communicator": "ssh", - // "ssh_username": "myuser", - // "pause_before_connecting": "10m" - // }] - // ``` - // - // - // - // - // ```hcl - // source "amazon-ebs" "example" { - // communicator = "ssh" - // ssh_username = "myuser" - // pause_before_connecting = "10m" - // } - // ``` - // - // - // - // - // In this example, Packer will check whether it can connect, as normal. But once - // a connection attempt is successful, it will disconnect and then wait 10 minutes - // before connecting to the guest and beginning provisioning. + // `pause_before_connecting`. By default, there is no pause. For example if + // you set `pause_before_connecting` to `10m` Packer will check whether it + // can connect, as normal. But once a connection attempt is successful, it + // will disconnect and then wait 10 minutes before connecting to the guest + // and beginning provisioning. PauseBeforeConnect time.Duration `mapstructure:"pause_before_connecting"` SSH `mapstructure:",squash"` diff --git a/website/pages/partials/helper/communicator/Config-not-required.mdx b/website/pages/partials/helper/communicator/Config-not-required.mdx index 075f85672..a0ffb17d3 100644 --- a/website/pages/partials/helper/communicator/Config-not-required.mdx +++ b/website/pages/partials/helper/communicator/Config-not-required.mdx @@ -16,38 +16,13 @@ files. - `pause_before_connecting` (duration string | ex: "1h5m2s") - We recommend that you enable SSH or WinRM as the very last step in your - guest's bootstrap script, but sometimes you may have a race condition where - you need Packer to wait before attempting to connect to your guest. + guest's bootstrap script, but sometimes you may have a race condition + where you need Packer to wait before attempting to connect to your + guest. If you end up in this situation, you can use the template option - `pause_before_connecting`. By default, there is no pause. For example: - - - - - ```json - "builders" [{ - ... - "communicator": "ssh", - "ssh_username": "myuser", - "pause_before_connecting": "10m" - }] - ``` - - - - - ```hcl - source "amazon-ebs" "example" { - communicator = "ssh" - ssh_username = "myuser" - pause_before_connecting = "10m" - } - ``` - - - - - In this example, Packer will check whether it can connect, as normal. But once - a connection attempt is successful, it will disconnect and then wait 10 minutes - before connecting to the guest and beginning provisioning. + `pause_before_connecting`. By default, there is no pause. For example if + you set `pause_before_connecting` to `10m` Packer will check whether it + can connect, as normal. But once a connection attempt is successful, it + will disconnect and then wait 10 minutes before connecting to the guest + and beginning provisioning.