diff --git a/go.mod b/go.mod index ef4fa87ca..4ec7a844c 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/terraform-providers/terraform-provider-aci go 1.12 require ( - github.com/ciscoecosystem/aci-go-client v1.23.1 + github.com/ciscoecosystem/aci-go-client v1.23.2 github.com/ghodss/yaml v1.0.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.3 ) diff --git a/go.sum b/go.sum index 1ff1a090d..639a78a49 100644 --- a/go.sum +++ b/go.sum @@ -65,8 +65,8 @@ github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXH github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/ciscoecosystem/aci-go-client v1.23.1 h1:zu4UNeXK7klKomUJ9p87NDNJ2LDAdRV1gIbD4+oT9Eo= -github.com/ciscoecosystem/aci-go-client v1.23.1/go.mod h1:pGK3tDhR/D4+P5f6utT1V7TQQxDw2fL7j79QXeVk6po= +github.com/ciscoecosystem/aci-go-client v1.23.2 h1:JtQIOsldHhy2Tk6ZgiIh7LZuiLD7oweeXL6ZIpxNyOY= +github.com/ciscoecosystem/aci-go-client v1.23.2/go.mod h1:pGK3tDhR/D4+P5f6utT1V7TQQxDw2fL7j79QXeVk6po= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/vendor/github.com/ciscoecosystem/aci-go-client/client/auth.go b/vendor/github.com/ciscoecosystem/aci-go-client/client/auth.go index 0737e0d1e..f43be4fa6 100644 --- a/vendor/github.com/ciscoecosystem/aci-go-client/client/auth.go +++ b/vendor/github.com/ciscoecosystem/aci-go-client/client/auth.go @@ -177,7 +177,7 @@ func loadPrivateKey(path string) (*rsa.PrivateKey, error) { } } - log.Printf("[DEBUG] priavte key read finish inside loadPrivateKey") + log.Printf("[DEBUG] private key read finish inside loadPrivateKey") if err != nil { return nil, err diff --git a/vendor/github.com/ciscoecosystem/aci-go-client/client/client.go b/vendor/github.com/ciscoecosystem/aci-go-client/client/client.go index 3a7661bce..1259b94e2 100644 --- a/vendor/github.com/ciscoecosystem/aci-go-client/client/client.go +++ b/vendor/github.com/ciscoecosystem/aci-go-client/client/client.go @@ -498,8 +498,15 @@ func StrtoInt(s string, startIndex int, bitSize int) (int64, error) { func (c *Client) Do(req *http.Request) (*container.Container, *http.Response, error) { log.Printf("[DEBUG] Begining Do method %s", req.URL.String()) + // retain the request body across multiple attempts + var body []byte + if req.Body != nil { + body, _ = ioutil.ReadAll(req.Body) + } + for attempts := 0; ; attempts++ { log.Printf("[TRACE] HTTP Request Method and URL: %s %s", req.Method, req.URL.String()) + req.Body = ioutil.NopCloser(bytes.NewBuffer(body)) if !c.skipLoggingPayload { log.Printf("[TRACE] HTTP Request Body: %v", req.Body) } @@ -529,7 +536,7 @@ func (c *Client) Do(req *http.Request) (*container.Container, *http.Response, er log.Printf("[DEBUG] HTTP response unique string %s %s %s", req.Method, req.URL.String(), bodyStr) } - if resp.StatusCode < 500 || resp.StatusCode > 504 { + if (resp.StatusCode < 500 || resp.StatusCode > 504) && resp.StatusCode != 405 { obj, err := container.ParseJSON(bodyBytes) if err != nil { log.Printf("[ERROR] Error occured while json parsing %+v", err) @@ -543,7 +550,7 @@ func (c *Client) Do(req *http.Request) (*container.Container, *http.Response, er if ok := c.backoff(attempts); !ok { obj, err := container.ParseJSON(bodyBytes) if err != nil { - log.Printf("[ERROR] Error occured while json parsing %+v with HTTP StatusCode 500-504", err) + log.Printf("[ERROR] Error occured while json parsing %+v with HTTP StatusCode 405, 500-504", err) log.Printf("[DEBUG] Exit from Do method") return nil, resp, err } @@ -561,8 +568,15 @@ func (c *Client) Do(req *http.Request) (*container.Container, *http.Response, er func (c *Client) DoRaw(req *http.Request) (*http.Response, error) { log.Printf("[DEBUG] Begining DoRaw method %s", req.URL.String()) + // retain the request body across multiple attempts + var body []byte + if req.Body != nil { + body, _ = ioutil.ReadAll(req.Body) + } + for attempts := 0; ; attempts++ { log.Printf("[TRACE] HTTP Request Method and URL: %s %s", req.Method, req.URL.String()) + req.Body = ioutil.NopCloser(bytes.NewBuffer(body)) if !c.skipLoggingPayload { log.Printf("[TRACE] HTTP Request Body: %v", req.Body) } @@ -585,7 +599,7 @@ func (c *Client) DoRaw(req *http.Request) (*http.Response, error) { log.Printf("[TRACE] HTTP Response: %d %s", resp.StatusCode, resp.Status) } - if resp.StatusCode < 500 || resp.StatusCode > 504 { + if (resp.StatusCode < 500 || resp.StatusCode > 504) && resp.StatusCode != 405 { log.Printf("[DEBUG] Exit from DoRaw method") return resp, nil } else { diff --git a/vendor/modules.txt b/vendor/modules.txt index 3dff7879f..4146f8805 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -54,7 +54,7 @@ github.com/aws/aws-sdk-go/service/sts github.com/aws/aws-sdk-go/service/sts/stsiface # github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d github.com/bgentry/go-netrc/netrc -# github.com/ciscoecosystem/aci-go-client v1.23.1 +# github.com/ciscoecosystem/aci-go-client v1.23.2 github.com/ciscoecosystem/aci-go-client/client github.com/ciscoecosystem/aci-go-client/container github.com/ciscoecosystem/aci-go-client/models