Skip to content

Commit

Permalink
Merge pull request Telmate#285 from thorntonmc/master
Browse files Browse the repository at this point in the history
type check memory
  • Loading branch information
mleone87 authored Dec 6, 2023
2 parents fc4fc66 + 0d37a47 commit cd1b0d8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion proxmox/config_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,16 @@ func (ConfigQemu) mapToStruct(params map[string]interface{}) (*ConfigQemu, error
config.Hookscript = params["hookscript"].(string)
}
if _, isSet := params["memory"]; isSet {
config.Memory = int(params["memory"].(float64))
switch params["memory"].(type) {
case float64:
config.Memory = int(params["memory"].(float64))
case string:
mem, err := strconv.ParseFloat(params["memory"].(string), 64)
if err != nil {
return nil, err
}
config.Memory = int(mem)
}
}
if _, isSet := params["name"]; isSet {
config.Name = params["name"].(string)
Expand Down

0 comments on commit cd1b0d8

Please sign in to comment.