diff --git a/go.mod b/go.mod index 60b685588..400435df1 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/NaverCloudPlatform/ncloud-sdk-go-v2 v1.1.0 github.com/PuerkitoBio/goquery v1.5.0 // indirect github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect - github.com/Telmate/proxmox-api-go v0.0.0-20200116224409-320525bf3340 + github.com/Telmate/proxmox-api-go v0.0.0-20200225212220-a29566462efd github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af // indirect github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190418113227-25233c783f4e github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170113022742-e6dbea820a9f diff --git a/go.sum b/go.sum index 15e61f1dd..36a39c483 100644 --- a/go.sum +++ b/go.sum @@ -43,6 +43,8 @@ github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUW github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/Telmate/proxmox-api-go v0.0.0-20200116224409-320525bf3340 h1:bOjy6c07dpipWm11dL92FbtmXGnDywOm2uKzG4CePuY= github.com/Telmate/proxmox-api-go v0.0.0-20200116224409-320525bf3340/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ= +github.com/Telmate/proxmox-api-go v0.0.0-20200225212220-a29566462efd h1:Moss3RtB00h4omKW+leNGIGIfmHcnkZPTJ5d0A0fY14= +github.com/Telmate/proxmox-api-go v0.0.0-20200225212220-a29566462efd/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af h1:DBNMBMuMiWYu0b+8KMJuWmfCkcxl09JwdlqwDZZ6U14= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= diff --git a/vendor/github.com/Telmate/proxmox-api-go/proxmox/config_qemu.go b/vendor/github.com/Telmate/proxmox-api-go/proxmox/config_qemu.go index 10f23641d..43f0a1920 100644 --- a/vendor/github.com/Telmate/proxmox-api-go/proxmox/config_qemu.go +++ b/vendor/github.com/Telmate/proxmox-api-go/proxmox/config_qemu.go @@ -201,11 +201,7 @@ func (config ConfigQemu) CloneVm(sourceVmr *VmRef, vmr *VmRef, client *Client) ( } _, err = client.CloneQemuVm(sourceVmr, params) - if err != nil { - return - } - - return config.UpdateConfig(vmr, client) + return err } func (config ConfigQemu) UpdateConfig(vmr *VmRef, client *Client) (err error) { @@ -251,7 +247,7 @@ func (config ConfigQemu) UpdateConfig(vmr *VmRef, client *Client) (err error) { } // Create disks config. - configParamsDisk := map[string]interface{} { + configParamsDisk := map[string]interface{}{ "vmid": vmr.vmId, } config.CreateQemuDisksParams(vmr.vmId, configParamsDisk, false) diff --git a/vendor/github.com/Telmate/proxmox-api-go/proxmox/session.go b/vendor/github.com/Telmate/proxmox-api-go/proxmox/session.go index 95da7d615..819bc6903 100644 --- a/vendor/github.com/Telmate/proxmox-api-go/proxmox/session.go +++ b/vendor/github.com/Telmate/proxmox-api-go/proxmox/session.go @@ -167,11 +167,21 @@ func (s *Session) Do(req *http.Request) (*http.Response, error) { } resp, err := s.httpClient.Do(req) - if err != nil { return nil, err } + // The response body reader needs to be closed, but lots of places call + // session.Do, and they might not be able to reliably close it themselves. + // Therefore, read the body out, close the original, then replace it with + // a NopCloser over the bytes, which does not need to be closed downsteam. + respBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + resp.Body.Close() + resp.Body = ioutil.NopCloser(bytes.NewReader(respBody)) + if *Debug { dr, _ := httputil.DumpResponse(resp, true) log.Printf("<<<<<<<<<< RESULT:\n%v", string(dr)) diff --git a/vendor/modules.txt b/vendor/modules.txt index 59b8dce5e..65491cc03 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -62,7 +62,7 @@ github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server github.com/PuerkitoBio/goquery # github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d github.com/StackExchange/wmi -# github.com/Telmate/proxmox-api-go v0.0.0-20200116224409-320525bf3340 +# github.com/Telmate/proxmox-api-go v0.0.0-20200225212220-a29566462efd github.com/Telmate/proxmox-api-go/proxmox # github.com/agext/levenshtein v1.2.1 github.com/agext/levenshtein