From 9d51f1ee1557a5b409ea3548168690063800b4d9 Mon Sep 17 00:00:00 2001 From: frosty Date: Fri, 17 Nov 2023 19:42:30 +0100 Subject: [PATCH] Fix Proxmox v8.0.4 panic interface {} is string, not float64 Workaround by jm-bertheas-datailor for: panic: interface conversion: interface {} is string, not float64 goroutine 135 [running]: github.com/Telmate/proxmox-api-go/proxmox.NewConfigQemuFromApi See: https://github.com/Telmate/terraform-provider-proxmox/issues/863#issuecomment-1814838167 --- proxmox/config_qemu.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/proxmox/config_qemu.go b/proxmox/config_qemu.go index 58d4795d..4256ce55 100644 --- a/proxmox/config_qemu.go +++ b/proxmox/config_qemu.go @@ -581,7 +581,18 @@ func NewConfigQemuFromApi(vmr *VmRef, client *Client) (config *ConfigQemu, err e } memory := 0.0 if _, isSet := vmConfig["memory"]; isSet { - memory = vmConfig["memory"].(float64) + switch vmConfig["memory"].(type) { + case float64: + memory = vmConfig["memory"].(float64) + case string: + memory2, err := strconv.ParseFloat(vmConfig["memory"].(string), 64) + if err != nil { + log.Fatal(err) + return nil, err + } else { + memory = memory2 + } + } } balloon := 0.0 if _, isSet := vmConfig["balloon"]; isSet {