mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-25 03:46:49 +00:00
fix: Set-PveHaRule requires mandatory Type parameter
PVE 9 API requires 'type' on PUT /cluster/ha/rules/{rule} even for
updates. Added mandatory Type parameter with ValidateSet for
node-affinity and resource-affinity.
Updated integration test and Pester unit tests to pass -Type.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,11 @@ namespace PSProxmoxVE.Cmdlets.HA
|
||||
HelpMessage = "HA rule ID.")]
|
||||
public string Rule { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Rule type (required by PVE API on update).</summary>
|
||||
[Parameter(Mandatory = true, Position = 1, HelpMessage = "HA rule type: node-affinity or resource-affinity.")]
|
||||
[ValidateSet("node-affinity", "resource-affinity")]
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Rule state.</summary>
|
||||
[Parameter(Mandatory = false, HelpMessage = "Rule state: enabled or disabled.")]
|
||||
[ValidateSet("enabled", "disabled")]
|
||||
@@ -42,7 +47,7 @@ namespace PSProxmoxVE.Cmdlets.HA
|
||||
|
||||
var service = new HaService();
|
||||
|
||||
var data = new Dictionary<string, string>();
|
||||
var data = new Dictionary<string, string> { ["type"] = Type };
|
||||
if (State != null) data["state"] = State;
|
||||
if (Comment != null) data["comment"] = Comment;
|
||||
if (Properties != null)
|
||||
|
||||
Reference in New Issue
Block a user