Switch default restart to Sonic MF Management API via Domain Manager.

Use ConnectionUrl and SMC credentials with IAgentProxy.restart; keep WinRM only as optional fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-24 08:54:53 +02:00
co-authored by Cursor
parent d71d6990ad
commit 11941a45f5
8 changed files with 962 additions and 31 deletions
@@ -27,7 +27,7 @@ public sealed class WinRmExecutor
public async Task<(bool Success, string? Error)> TestConnectionAsync(
CancellationToken cancellationToken = default)
{
if (_connection.ManagementMode == SonicManagementMode.LocalCmd)
if (_connection.EffectiveManagementMode == SonicManagementMode.LocalCmd)
{
(bool ok, string? output, string? error) = await RunScriptAsync(
"$env:COMPUTERNAME", cancellationToken);
@@ -66,7 +66,7 @@ public sealed class WinRmExecutor
string scriptBlock,
CancellationToken cancellationToken = default)
{
string fullScript = _connection.ManagementMode == SonicManagementMode.LocalCmd
string fullScript = _connection.EffectiveManagementMode == SonicManagementMode.LocalCmd
? BuildLocalScript(scriptBlock)
: BuildRemoteScript(ExtractHost(_connection.ConnectionUrl), scriptBlock);
@@ -126,7 +126,7 @@ public sealed class WinRmExecutor
? stderr
: $"PowerShell ExitCode={process.ExitCode}";
string error = _connection.ManagementMode == SonicManagementMode.WinRm
string error = _connection.EffectiveManagementMode == SonicManagementMode.WinRm
? FormatWinRmFailure(rawError)
: Truncate(rawError);