From f1d36bb0827576c13c0f189cfc7d161af494e198 Mon Sep 17 00:00:00 2001 From: Myfro9 <36755290+Myfro9@users.noreply.github.com> Date: Wed, 2 Sep 2026 15:37:47 -0500 Subject: [PATCH] sync: BOWEI_US 2026-09-02 --- tools-sync/scripts/gitea_doctor.ps1 | 6 +++--- tools-sync/scripts/sync_repos.ps1 | 15 +++++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/tools-sync/scripts/gitea_doctor.ps1 b/tools-sync/scripts/gitea_doctor.ps1 index 1f97f26..ba492f0 100644 --- a/tools-sync/scripts/gitea_doctor.ps1 +++ b/tools-sync/scripts/gitea_doctor.ps1 @@ -131,8 +131,8 @@ $triageStaged = Join-Path ([IO.Path]::GetTempPath()) "tools-sync-triage-$PID.sh" $triageText = ((Get-Content $triage -Raw) -replace "`r`n", "`n") -replace "^", "" [IO.File]::WriteAllText($triageStaged, $triageText, (New-Object System.Text.UTF8Encoding($false))) -$args = @("--container", $container, "--docker", $dockerBin, "--fix") -if ($AllowDestructive) { $args += "--allow-destructive" } +$triageArgs = @("--container", $container, "--docker", $dockerBin, "--fix") +if ($AllowDestructive) { $triageArgs += "--allow-destructive" } $targets = @(@{ H = $sshHost; P = $sshPort; Label = "direct" }) if ($sshHostA -and $sshPortA) { $targets += @{ H = $sshHostA; P = $sshPortA; Label = "fallback" } } @@ -141,7 +141,7 @@ $r = $null foreach ($tg in $targets) { Write-Host "" Write-Host "=== server triage via $($tg.Label): $sshUser@$($tg.H):$($tg.P) ===" - $r = Invoke-Remote $tg.H $tg.P $triageStaged $args + $r = Invoke-Remote $tg.H $tg.P $triageStaged $triageArgs if ($r.Out -notmatch "Connection (timed out|refused)|Could not resolve|Permission denied|No route to host|lost connection") { break } Write-Host " unreachable: $(($r.Out -split "`n")[0])" $r = $null diff --git a/tools-sync/scripts/sync_repos.ps1 b/tools-sync/scripts/sync_repos.ps1 index ed064a0..547a8bc 100644 --- a/tools-sync/scripts/sync_repos.ps1 +++ b/tools-sync/scripts/sync_repos.ps1 @@ -52,10 +52,17 @@ function Invoke-Doctor([string]$Why) { if (-not (Test-Path $doctor)) { Write-Host "gitea_doctor.ps1 not found; cannot repair the server."; return $false } Write-Host "" Write-Host "=== gitea transport check/repair ($Why) ===" - $dargs = @("-RepoUrl", $RepoUrl, "-Fix") - if ($AllowDestructive) { $dargs += "-AllowDestructive" } - & $doctor @dargs - $ok = ($LASTEXITCODE -eq 0) + # Hashtable splat, not an array: splatting an array passes every element + # positionally, so "-Fix" would be bound as a value (it lands on -SshTimeout). + $dargs = @{ RepoUrl = $RepoUrl; Fix = $true } + if ($AllowDestructive) { $dargs["AllowDestructive"] = $true } + $ok = $false + try { + & $doctor @dargs + $ok = ($LASTEXITCODE -eq 0) + } catch { + Write-Host "doctor could not be invoked: $($_.Exception.Message)" + } Write-Host "=== doctor $(if ($ok) { 'reports the transport healthy' } else { 'could NOT restore the transport' }) ===" Write-Host "" return $ok