mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-07-26 07:58:14 +00:00
feat: add parameter-level version warnings for named params from newer PVE
Warn (not block) when users pass named parameters that were added in later PVE versions: - Send-PveFile: -Checksum/-ChecksumAlgorithm require PVE 7.1 - New/Set-PveSdnSubnet: -DhcpRange requires PVE 8.1 These are warnings, not hard blocks — the parameter is still sent to the API, which will either accept it or return its own error. This only applies to named cmdlet parameters, not AdditionalConfig pass-through hashtables. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,14 @@ namespace PSProxmoxVE.Cmdlets.Network
|
||||
|
||||
var session = GetSession();
|
||||
RequireVersion(session, "SDN", 6, 2, 8, 0);
|
||||
|
||||
if (!string.IsNullOrEmpty(DhcpRange)
|
||||
&& session.ServerVersion != null && !session.ServerVersion.IsAtLeast(8, 1))
|
||||
{
|
||||
WriteWarning("The -DhcpRange parameter requires PVE 8.1 or later. "
|
||||
+ $"Connected server is PVE {session.ServerVersion}. The parameter will be sent but may be ignored.");
|
||||
}
|
||||
|
||||
using var client = new PveHttpClient(session);
|
||||
|
||||
WriteVerbose($"Creating SDN subnet '{Subnet}' on VNet '{Vnet}'...");
|
||||
|
||||
@@ -45,6 +45,14 @@ namespace PSProxmoxVE.Cmdlets.Network
|
||||
|
||||
var session = GetSession();
|
||||
RequireVersion(session, "SDN", 6, 2, 8, 0);
|
||||
|
||||
if (!string.IsNullOrEmpty(DhcpRange)
|
||||
&& session.ServerVersion != null && !session.ServerVersion.IsAtLeast(8, 1))
|
||||
{
|
||||
WriteWarning("The -DhcpRange parameter requires PVE 8.1 or later. "
|
||||
+ $"Connected server is PVE {session.ServerVersion}. The parameter will be sent but may be ignored.");
|
||||
}
|
||||
|
||||
var service = new NetworkService();
|
||||
|
||||
WriteVerbose($"Updating SDN subnet '{Subnet}' on VNet '{Vnet}'...");
|
||||
|
||||
@@ -66,6 +66,14 @@ namespace PSProxmoxVE.Cmdlets.Storage
|
||||
return;
|
||||
|
||||
var session = GetSession();
|
||||
|
||||
if ((!string.IsNullOrEmpty(Checksum) || !string.IsNullOrEmpty(ChecksumAlgorithm))
|
||||
&& session.ServerVersion != null && !session.ServerVersion.IsAtLeast(7, 1))
|
||||
{
|
||||
WriteWarning("The -Checksum and -ChecksumAlgorithm parameters require PVE 7.1 or later. "
|
||||
+ $"Connected server is PVE {session.ServerVersion}. The upload will proceed without checksum verification.");
|
||||
}
|
||||
|
||||
using var client = new PveHttpClient(session);
|
||||
|
||||
WriteVerbose($"Uploading {fileName} to {Node}/{Storage} (content={ContentType})...");
|
||||
|
||||
Reference in New Issue
Block a user