fix: address Copilot review feedback on PR #27

- Extract ParseLinks helper to PveCmdletBase for shared link parsing
  with WriteWarning on malformed entries (was duplicated in 3 cmdlets)
- Fix GetClusterConfig to return data payload, not full API envelope
- Fix OutputType on GetPveClusterConfigCmdlet to JObject
- Fix link doc comments to use correct key format (link0..link7)
- Add null-safe Properties hashtable conversion in HA rule cmdlets
- Use case-insensitive Mode comparison in MovePveHaResourceCmdlet
- Remove unused using directives

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Clint Branham
2026-03-24 18:40:10 -05:00
parent da2037d0c5
commit f1a3676723
9 changed files with 43 additions and 42 deletions
@@ -41,7 +41,8 @@ namespace PSProxmoxVE.Core.Services
try
{
var response = client.GetAsync("cluster/config").GetAwaiter().GetResult();
return JObject.Parse(response);
var data = JObject.Parse(response)["data"];
return data as JObject ?? new JObject();
}
finally
{
@@ -54,7 +55,7 @@ namespace PSProxmoxVE.Core.Services
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="clusterName">The name for the new cluster.</param>
/// <param name="links">Optional Corosync link addresses (e.g., "0=10.0.0.1,1=10.0.1.1").</param>
/// <param name="links">Optional Corosync link addresses, using keys link0..link7 (e.g., "link0=10.0.0.1").</param>
/// <param name="nodeid">Optional node ID for this node.</param>
/// <param name="votes">Optional number of quorum votes for this node.</param>
/// <returns>The UPID of the cluster creation task.</returns>