mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-08-22 11:28:33 +00:00
fix(vm): panic when reading VM with SPICE USB passthrough (#1438)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
b63c98b13f
commit
fc42ac3a5e
@ -77,7 +77,7 @@ func (r *CustomUSBDevice) UnmarshalJSON(b []byte) error {
|
||||
for _, p := range pairs {
|
||||
v := strings.Split(strings.TrimSpace(p), "=")
|
||||
if len(v) == 1 {
|
||||
r.HostDevice = &v[1]
|
||||
r.HostDevice = &v[0]
|
||||
} else if len(v) == 2 {
|
||||
switch v[0] {
|
||||
case "host":
|
||||
|
@ -46,6 +46,13 @@ func TestCustomUSBDevice_UnmarshalJSON(t *testing.T) {
|
||||
USB3: types.CustomBool(false).Pointer(),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "spice usb device",
|
||||
line: `"spice"`,
|
||||
want: &CustomUSBDevice{
|
||||
HostDevice: ptr.Ptr("spice"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
Loading…
Reference in New Issue
Block a user