diff --git a/go.mod b/go.mod index dd9e6a91..46074b77 100644 --- a/go.mod +++ b/go.mod @@ -55,3 +55,7 @@ require ( google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace github.com/masterzen/winrm => github.com/bosh-dep-forks/winrm v0.0.0-20240321234108-df0e10ca9199 + +replace github.com/packer-community/winrmcp => github.com/bosh-dep-forks/winrmcp v0.0.0-20240506194308-1105f7feefc7 diff --git a/go.sum b/go.sum index c75d94d2..1342ee2c 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,10 @@ github.com/bodgit/ntlmssp v0.0.0-20240405225621-bc7a66a52237 h1:IRHxBGP4NtipmCHv github.com/bodgit/ntlmssp v0.0.0-20240405225621-bc7a66a52237/go.mod h1:ZcREh7an/iQI1JTsS+K9YAlig9Twd+OAGqB75LT+5+8= github.com/bodgit/windows v1.0.1 h1:tF7K6KOluPYygXa3Z2594zxlkbKPAOvqr97etrGNIz4= github.com/bodgit/windows v1.0.1/go.mod h1:a6JLwrB4KrTR5hBpp8FI9/9W9jJfeQ2h4XDXU74ZCdM= +github.com/bosh-dep-forks/winrm v0.0.0-20240321234108-df0e10ca9199 h1:r+PWI7A4K516n3vsCpt1EqPKxOUR4pf421cUkLS+N3Q= +github.com/bosh-dep-forks/winrm v0.0.0-20240321234108-df0e10ca9199/go.mod h1:otHfftEJdo9JWGoq9GcJRaeNLp/uhqNq8JOk5lL+8Ks= +github.com/bosh-dep-forks/winrmcp v0.0.0-20240506194308-1105f7feefc7 h1:XYRnxVBwHQp8t8HuXVj5mrFpg9o8RROlVXgZWmHDZmw= +github.com/bosh-dep-forks/winrmcp v0.0.0-20240506194308-1105f7feefc7/go.mod h1:XqA4/u+BKsCZL3OWCFUYKBUkITkjyFL4+hvRxDBAY5w= github.com/concourse/pool-resource v1.1.1 h1:c1G+A4ncmdCr5DWDSdhg9wRaYBLn7cX8e5nxvCNXLYw= github.com/concourse/pool-resource v1.1.1/go.mod h1:g6Q2Jjcl64dYYqprEhjhELiVLa/fl6ybgU4s9nUoB4A= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -80,8 +84,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 h1:2ZKn+w/BJeL43sCxI2jhPLRv73oVVOjEKZjKkflyqxg= github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= -github.com/masterzen/winrm v0.0.0-20231227165926-e811dad5ac77 h1:psY7rHKhnfqjTEgkleIYpF1vVxVfYsUYFTO/cL5Z6xM= -github.com/masterzen/winrm v0.0.0-20231227165926-e811dad5ac77/go.mod h1:otHfftEJdo9JWGoq9GcJRaeNLp/uhqNq8JOk5lL+8Ks= github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1 h1:NicmruxkeqHjDv03SfSxqmaLuisddudfP3h5wdXFbhM= github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1/go.mod h1:eyp4DdUJAKkr9tvxR3jWhw2mDK7CWABMG5r9uyaKC7I= github.com/mitchellh/mapstructure v1.3.0 h1:iDwIio/3gk2QtLLEsqU5lInaMzos0hDTz8a6lazSFVw= @@ -101,8 +103,6 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= -github.com/packer-community/winrmcp v0.0.0-20221126162354-6e900dd2c68f h1:sWm3fnjG6kxvDuGiQf46Io5xCTj3QJfNJIeICJ4g1kw= -github.com/packer-community/winrmcp v0.0.0-20221126162354-6e900dd2c68f/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/remotemanager/winrm_remotemanager.go b/remotemanager/winrm_remotemanager.go index f4faea26..954b6285 100644 --- a/remotemanager/winrm_remotemanager.go +++ b/remotemanager/winrm_remotemanager.go @@ -70,6 +70,7 @@ func (w *WinRM) UploadArtifact(sourceFilePath, destinationFilePath string) error ConnectTimeout: WinRmTimeout, OperationTimeout: WinRmTimeout, MaxOperationsPerShell: 15, + AllowTimeout: true, }) if err != nil { diff --git a/vendor/github.com/masterzen/winrm/command.go b/vendor/github.com/masterzen/winrm/command.go index f7c35514..a7cecb52 100644 --- a/vendor/github.com/masterzen/winrm/command.go +++ b/vendor/github.com/masterzen/winrm/command.go @@ -144,7 +144,7 @@ func (c *Command) slurpAllOutput() (bool, error) { response, err := c.client.sendRequest(request) if err != nil { var errWithTimeout *url.Error - if errors.As(err, &errWithTimeout) && errWithTimeout.Timeout() { + if !c.client.AllowTimeout && errors.As(err, &errWithTimeout) && errWithTimeout.Timeout() { // Operation timeout because the server didn't respond in time return false, err } diff --git a/vendor/github.com/masterzen/winrm/parameters.go b/vendor/github.com/masterzen/winrm/parameters.go index 08adcc99..d0c1c1ae 100644 --- a/vendor/github.com/masterzen/winrm/parameters.go +++ b/vendor/github.com/masterzen/winrm/parameters.go @@ -8,6 +8,7 @@ type Parameters struct { Timeout string Locale string EnvelopeSize int + AllowTimeout bool // Allow Commands to finish if connection times out. Useful if the command causes the Host to shut down. TransportDecorator func() Transporter Dial func(network, addr string) (net.Conn, error) } diff --git a/vendor/github.com/packer-community/winrmcp/winrmcp/winrmcp.go b/vendor/github.com/packer-community/winrmcp/winrmcp/winrmcp.go index df2c2e3e..7cfab774 100644 --- a/vendor/github.com/packer-community/winrmcp/winrmcp/winrmcp.go +++ b/vendor/github.com/packer-community/winrmcp/winrmcp/winrmcp.go @@ -26,6 +26,7 @@ type Config struct { OperationTimeout time.Duration MaxOperationsPerShell int TransportDecorator func() winrm.Transporter + AllowTimeout bool } type Auth struct { @@ -48,6 +49,8 @@ func New(addr string, config *Config) (*Winrmcp, error) { winrm.DefaultParameters.EnvelopeSize, ) + params.AllowTimeout = config.AllowTimeout + if config.TransportDecorator != nil { params.TransportDecorator = config.TransportDecorator } diff --git a/vendor/modules.txt b/vendor/modules.txt index 5edfdeac..a613db35 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -132,7 +132,7 @@ github.com/kr/text # github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 ## explicit github.com/masterzen/simplexml/dom -# github.com/masterzen/winrm v0.0.0-20231227165926-e811dad5ac77 +# github.com/masterzen/winrm v0.0.0-20231227165926-e811dad5ac77 => github.com/bosh-dep-forks/winrm v0.0.0-20240321234108-df0e10ca9199 ## explicit; go 1.21 github.com/masterzen/winrm github.com/masterzen/winrm/soap @@ -187,7 +187,7 @@ github.com/onsi/gomega/matchers/support/goraph/edge github.com/onsi/gomega/matchers/support/goraph/node github.com/onsi/gomega/matchers/support/goraph/util github.com/onsi/gomega/types -# github.com/packer-community/winrmcp v0.0.0-20221126162354-6e900dd2c68f +# github.com/packer-community/winrmcp v0.0.0-20221126162354-6e900dd2c68f => github.com/bosh-dep-forks/winrmcp v0.0.0-20240506194308-1105f7feefc7 ## explicit github.com/packer-community/winrmcp/winrmcp # github.com/pkg/errors v0.9.1 @@ -358,3 +358,5 @@ google.golang.org/protobuf/runtime/protoimpl # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 +# github.com/masterzen/winrm => github.com/bosh-dep-forks/winrm v0.0.0-20240321234108-df0e10ca9199 +# github.com/packer-community/winrmcp => github.com/bosh-dep-forks/winrmcp v0.0.0-20240506194308-1105f7feefc7