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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user