mirror of
https://github.com/Telmate/proxmox-api-go.git
synced 2026-04-26 07:55:50 +03:00
[GH-ISSUE #104] DeleteVm silently ignores a 501 response #17
Labels
No labels
good first issue
issue/confirmed
issue/critical
proposal/accepted
pull-request
type/bug
type/enhancement
type/feature
type/question
type/refactoring
type/testing
type/testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/proxmox-api-go#17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ghost on GitHub (Mar 4, 2021).
Original GitHub issue: https://github.com/Telmate/proxmox-api-go/issues/104
When I call
DeleteVm, it callsDeleteVmParams, which seems to ignore an error returned by the server.After turning debug on, I get the following:
Request:
Response:
However, as a caller, I get
err = nilin the result of the call toDeleteVmWhen I call the endpoint manually:
it works fine and proxmox removes the VM.
This happens on
7008020and Proxmox version: 6.3-4 (I also observed it on 6.2-11)@GmzAmz commented on GitHub (May 3, 2021):
Disclaimer: I barely know go. I am 100% sure there's a better way to do this.
I have this issue as well. You can recreate the problem by passing
'""'to -d in curl in your manual example. Appears as if it's expecting a body but it doesn't have one. Since it passes it passes an empty map rather than nil, it runs jsonMarshal on nothing, producing"". That's what's causing the error.I was able to fix it by checking len(reqbody) and if it's 0, passing nil to RequestJSON rather than &reqbody. No guarantees that doesn't mess up something else, though the only function that references this function is just a thin wrapper so it might be fine.