mirror of
https://github.com/luthermonson/go-proxmox.git
synced 2026-04-26 09:25:53 +03:00
[GH-ISSUE #120] Invalid memory address or nil pointer dereference on vm.Delete() #23
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/go-proxmox#23
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 @SnelsSM on GitHub (Feb 25, 2024).
Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/120
Hi!
Function Delete for VM fails with
runtime error: invalid memory address or nil pointer dereferenceMy code
vm.Stop works but vm.Delete fails
Am I doing something wrong or is the problem in the module?
@luthermonson commented on GitHub (Feb 25, 2024):
how did you make the vm you are making these Delete calls against? because it's complaining that the vm config is nil and that is populated here: https://github.com/luthermonson/go-proxmox/blob/main/nodes.go#L76-L78
did you not make the vm via
node.VirtualMachine(ctx, id)?@luthermonson commented on GitHub (Feb 25, 2024):
you can use beta4 release now which has a nil check and won't error there... the delete is checking for an existing cloud init iso made by the package and if the config is empty it can't really do that so we will just continue on. you should consider before manipulating your vms though to pull full info for the vm via node.VirtualMachine as it gives you the most complete information for that vm