Skip to content

Commit

Permalink
Merge pull request #348 from Tinyblargon/fix-description
Browse files Browse the repository at this point in the history
fix: can't clear `description`
  • Loading branch information
Tinyblargon committed Jul 26, 2024
2 parents b5ee3f5 + 43cbc51 commit 4c4580d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions proxmox/config_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,15 @@ func (config ConfigQemu) mapToAPI(currentConfig ConfigQemu, version Version) (re
if config.Boot != "" {
params["boot"] = config.Boot
}
if config.Description != nil && (*config.Description != "" || currentConfig.Description != nil) {
params["description"] = *config.Description
}
if config.QemuCores != 0 {
params["cores"] = config.QemuCores
}
if config.QemuCpu != "" {
params["cpu"] = config.QemuCpu
}
if config.Description != nil {
if *config.Description != "" {
params["description"] = *config.Description
} else if currentConfig.Description != nil {
itemsToDelete += ",description"
}
}
if config.Hookscript != "" {
params["hookscript"] = config.Hookscript
}
Expand Down
2 changes: 1 addition & 1 deletion proxmox/config_qemu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ func Test_ConfigQemu_mapToAPI(t *testing.T) {
{name: `Description empty`,
config: &ConfigQemu{Description: util.Pointer("")},
currentConfig: ConfigQemu{Description: util.Pointer("old description")},
output: map[string]interface{}{"delete": "description"}}}},
output: map[string]interface{}{"description": ""}}}},
{category: `Disks.Ide`,
update: []test{
{name: `Disk.Ide.Disk_X DELETE`,
Expand Down

0 comments on commit 4c4580d

Please sign in to comment.