Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createKubeconfig function should not close http reponse body #116

Closed
waynz0r opened this issue Jul 4, 2018 · 4 comments
Closed

createKubeconfig function should not close http reponse body #116

waynz0r opened this issue Jul 4, 2018 · 4 comments
Assignees

Comments

@waynz0r
Copy link

waynz0r commented Jul 4, 2018

Hi,

the defer common.CloseBodyIfValid(httpResponse) call in the containerengine.createKubeconfig function closes the http body which makes impossible to get the content of it.

// createKubeconfig implements the OCIOperation interface (enables retrying operations)
func (client ContainerEngineClient) createKubeconfig(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
httpRequest, err := request.HTTPRequest(http.MethodPost, "/clusters/{clusterId}/kubeconfig/content")
if err != nil {
return nil, err
}

var response CreateKubeconfigResponse
var httpResponse *http.Response
httpResponse, err = client.Call(ctx, &httpRequest)
defer common.CloseBodyIfValid(httpResponse)
response.RawResponse = httpResponse
if err != nil {
return response, err
}

err = common.UnmarshalResponse(httpResponse, &response)
return response, err
}

Thanks!

@jasonyin
Copy link
Contributor

jasonyin commented Jul 5, 2018

thanks for reporting this issue and submit the PR, I am looking at the PR now.

@jasonyin
Copy link
Contributor

jasonyin commented Jul 5, 2018

update for others who saw the same issue:

  1. here is a temp solution to solve the issue Fix premature response.Body closing in case of "binary" encoding #117 to unblock yourself;
  2. it will be fixed and released on 07/12 (next sdk release);

@bonifaido
Copy link

Hi @jasonyin, just a question, will be the new SDK released today?

@jasonyin
Copy link
Contributor

fixed in https://github.com/oracle/oci-go-sdk/releases/tag/v2.0.0

alexng-canuck pushed a commit that referenced this issue Aug 16, 2018
Squashed commit of the following:

commit 231a5e41295c0c7f28ec8c4a2fbb50dfe78f1e15
Author: Jason Yin <jason.yin@oracle.com>
Date:   Tue Jul 24 16:17:48 2018 -0700

    update github whitelist

commit 07fafb5b7f1c2276876c5405e8ef2796392d9d24
Author: Jason Yin <jason.yin@oracle.com>
Date:   Tue Jul 24 12:43:52 2018 -0700

    add rqs

commit 78d11b3052d85c7283a41a08eef305b9f5f78003
Author: Jason Yin <jason.yin@oracle.com>
Date:   Tue Jul 24 11:41:50 2018 -0700

    update core service to 202
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants