diff --git a/go.mod b/go.mod index 1577b434..a225e895 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.17 require ( github.com/hashicorp/hcl/v2 v2.13.0 - github.com/hashicorp/packer-plugin-sdk v0.3.0 + github.com/hashicorp/packer-plugin-sdk v0.3.1 github.com/vultr/govultr/v2 v2.17.2 github.com/zclconf/go-cty v1.10.0 golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 diff --git a/go.sum b/go.sum index a94a8e68..2276e89a 100644 --- a/go.sum +++ b/go.sum @@ -339,15 +339,14 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/hcl/v2 v2.12.0/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgCNc= github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= github.com/hashicorp/memberlist v0.2.2 h1:5+RffWKwqJ71YPu9mWsF7ZOscZmwfasdA8kbdC7AO2g= github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/packer-plugin-sdk v0.3.0 h1:G4Uze/85X3n6c+8DawHdxptOZ0vHOeJ2LAAhBFLjYmg= -github.com/hashicorp/packer-plugin-sdk v0.3.0/go.mod h1:bqpbL7w5Ee2QWrUyAsZI/MdCYpw15ls4mxgn9Ei2DZc= +github.com/hashicorp/packer-plugin-sdk v0.3.1 h1:Gr/mnihsdUcPfGiruFL93BQkiFh3EFPwyxxTWkwvRsQ= +github.com/hashicorp/packer-plugin-sdk v0.3.1/go.mod h1:+GzydiXdn0CkueigqXBsX4Poz5gfmFXZ/DkxKt4fmt4= github.com/hashicorp/serf v0.9.5 h1:EBWvyu9tcRszt3Bxp3KNssBMP1KuHWyO51lz9+786iM= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= github.com/hashicorp/vault/api v1.0.5-0.20200519221902-385fac77e20f/go.mod h1:euTFbi2YJgwcju3imEt919lhJKF68nN1cQPq3aA+kBE= @@ -567,7 +566,6 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= @@ -577,7 +575,6 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 h1:O8uGbHCqlTp2P6QJSLmCojM4mN6UemYv8K+dCnmHmu0= golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -709,7 +706,6 @@ golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/hashicorp/packer-plugin-sdk/communicator/config.go b/vendor/github.com/hashicorp/packer-plugin-sdk/communicator/config.go index 53b9ba8e..1bc2d602 100644 --- a/vendor/github.com/hashicorp/packer-plugin-sdk/communicator/config.go +++ b/vendor/github.com/hashicorp/packer-plugin-sdk/communicator/config.go @@ -123,6 +123,7 @@ type SSH struct { // The time to wait for SSH to become available. Packer uses this to // determine when the machine has booted so this is usually quite long. // Example value: `10m`. + // This defaults to `5m`, unless `ssh_handshake_attempts` is set. SSHTimeout time.Duration `mapstructure:"ssh_timeout"` // Deprecated in favor of SSHTimeout SSHWaitTimeout time.Duration `mapstructure:"ssh_wait_timeout" undocumented:"true"` @@ -135,8 +136,8 @@ type SSH struct { SSHAgentAuth bool `mapstructure:"ssh_agent_auth" undocumented:"true"` // If true, SSH agent forwarding will be disabled. Defaults to `false`. SSHDisableAgentForwarding bool `mapstructure:"ssh_disable_agent_forwarding"` - // The number of handshakes to attempt with SSH once it can connect. This - // defaults to `10`. + // The number of handshakes to attempt with SSH once it can connect. + // This defaults to `10`, unless a `ssh_timeout` is set. SSHHandshakeAttempts int `mapstructure:"ssh_handshake_attempts"` // A bastion host to use for the actual SSH connection. SSHBastionHost string `mapstructure:"ssh_bastion_host"` @@ -472,18 +473,16 @@ func (c *Config) prepareSSH(ctx *interpolate.Context) []error { c.SSHPort = 22 } - if c.SSHTimeout == 0 { + // Only set default values when neither are set + if c.SSHTimeout == 0 && c.SSHHandshakeAttempts == 0 { c.SSHTimeout = 5 * time.Minute + c.SSHHandshakeAttempts = 10 } if c.SSHKeepAliveInterval == 0 { c.SSHKeepAliveInterval = 5 * time.Second } - if c.SSHHandshakeAttempts == 0 { - c.SSHHandshakeAttempts = 10 - } - if c.SSHBastionHost != "" { if c.SSHBastionPort == 0 { c.SSHBastionPort = 22 diff --git a/vendor/github.com/hashicorp/packer-plugin-sdk/communicator/step_connect_ssh.go b/vendor/github.com/hashicorp/packer-plugin-sdk/communicator/step_connect_ssh.go index 7c6ed150..652b5c4b 100644 --- a/vendor/github.com/hashicorp/packer-plugin-sdk/communicator/step_connect_ssh.go +++ b/vendor/github.com/hashicorp/packer-plugin-sdk/communicator/step_connect_ssh.go @@ -50,7 +50,10 @@ func (s *StepConnectSSH) Run(ctx context.Context, state multistep.StateBag) mult }() log.Printf("[INFO] Waiting for SSH, up to timeout: %s", s.Config.SSHTimeout) - timeout := time.After(s.Config.SSHTimeout) + timeout := make(<-chan time.Time) + if s.Config.SSHTimeout > 0 { + timeout = time.After(s.Config.SSHTimeout) + } for { // Wait for either SSH to become available, a timeout to occur, // or an interrupt to come through. @@ -231,14 +234,15 @@ func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, ctx context.Contex handshakeAttempts += 1 } - if handshakeAttempts < s.Config.SSHHandshakeAttempts { - // Try to connect via SSH a handful of times. We sleep here - // so we don't get a ton of authentication errors back to back. - time.Sleep(2 * time.Second) - continue + if s.Config.SSHHandshakeAttempts > 0 && + handshakeAttempts >= s.Config.SSHHandshakeAttempts { + return nil, err } - return nil, err + // Try to connect via SSH a handful of times. We sleep here + // so we don't get a ton of authentication errors back to back. + time.Sleep(2 * time.Second) + continue } break diff --git a/vendor/github.com/hashicorp/packer-plugin-sdk/version/version.go b/vendor/github.com/hashicorp/packer-plugin-sdk/version/version.go index b5649441..d44a3689 100644 --- a/vendor/github.com/hashicorp/packer-plugin-sdk/version/version.go +++ b/vendor/github.com/hashicorp/packer-plugin-sdk/version/version.go @@ -13,7 +13,7 @@ import ( var GitCommit string // Package version helps plugin creators set and track the sdk version using -var Version = "0.3.0" +var Version = "0.3.1" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release diff --git a/vendor/modules.txt b/vendor/modules.txt index 4f8fb8e4..61e5ff18 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -203,7 +203,7 @@ github.com/hashicorp/hcl/json/token github.com/hashicorp/hcl/v2 github.com/hashicorp/hcl/v2/ext/customdecode github.com/hashicorp/hcl/v2/hcldec -# github.com/hashicorp/packer-plugin-sdk v0.3.0 +# github.com/hashicorp/packer-plugin-sdk v0.3.1 ## explicit; go 1.17 github.com/hashicorp/packer-plugin-sdk/acctest github.com/hashicorp/packer-plugin-sdk/common