mirror of
https://github.com/Corsinvest/cv4pve-api-powershell.git
synced 2026-04-25 12:15:48 +03:00
[GH-ISSUE #36] change [switch] to [bool] in New-PveNodesQemuConfig and Set-PveNodesQemuConfig to better support passing variables with value of false #25
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cv4pve-api-powershell#25
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 @acac9 on GitHub (Mar 11, 2025).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-powershell/issues/36
What happened?
First, thank you very much for the Fix #33. I encountered that issue also but before I could get back to report it I was delighted Erik-Horn had reported it and you had already fixed it.
Second, I found an additional change to follow on to the change from Issue #28. I found that Parameters with type [switch] in New-PveNodesQemuConfig and Set-PveNodesQemuConfig when the value passed in $false, get discarded by Powershell and not sent on to the API. This can be fixed by using type [bool]. I tested this with parameters $Acpi, $Freeze, and $Template.
I will attempt to paste full revised versions of those functions below into the "Relevant log output section" if I can but I'm not sure it will fit. The change is basically to run a find/replace to change [switch] to [bool] but only in the functions New-PveNodesQemuConfig and Set-PveNodesQemuConfig.
I see that [switch] type variables are used in some other functions but I have not tested their functioning so I can't make any comment about changing them.
Expected behavior
In this specific case, calling Set-PveNodesQemuConfig with -Template:$false when the target is a template, would turn the existing template into a VM.
Relevant log output
Proxmox VE Version
8.3.0
Version (bug)
8.3.0
Version (working)
No response
On what operating system are you experiencing the issue?
Windows
Pull Request
@franklupo commented on GitHub (Mar 12, 2025):
Hi,
could you test if "[switch]$Acpi = $false" works?
The functions are automatically generated, if they work I change everything.
Bets regards
@acac9 commented on GitHub (Mar 12, 2025):
If I run Set-PveNodesQemuConfig with -Acpi $false while the type is [switch] the change will fail with “parameter verification failed”. If the type is [bool] it will work.
But I have only tested Set-PveNodesQemuConfig and new-PveNodesQemuConfig.
What I mean is that other functions such as set-pvepoolsidx use [switch] for some parameters but I have never used or tested that function.