sync: BOWEI_US 2026-09-02

This commit is contained in:
Myfro9
2026-09-02 15:37:47 -05:00
parent 67ca51b2c2
commit f1d36bb082
2 changed files with 14 additions and 7 deletions
+3 -3
View File
@@ -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 "^", "" $triageText = ((Get-Content $triage -Raw) -replace "`r`n", "`n") -replace "^", ""
[IO.File]::WriteAllText($triageStaged, $triageText, (New-Object System.Text.UTF8Encoding($false))) [IO.File]::WriteAllText($triageStaged, $triageText, (New-Object System.Text.UTF8Encoding($false)))
$args = @("--container", $container, "--docker", $dockerBin, "--fix") $triageArgs = @("--container", $container, "--docker", $dockerBin, "--fix")
if ($AllowDestructive) { $args += "--allow-destructive" } if ($AllowDestructive) { $triageArgs += "--allow-destructive" }
$targets = @(@{ H = $sshHost; P = $sshPort; Label = "direct" }) $targets = @(@{ H = $sshHost; P = $sshPort; Label = "direct" })
if ($sshHostA -and $sshPortA) { $targets += @{ H = $sshHostA; P = $sshPortA; Label = "fallback" } } if ($sshHostA -and $sshPortA) { $targets += @{ H = $sshHostA; P = $sshPortA; Label = "fallback" } }
@@ -141,7 +141,7 @@ $r = $null
foreach ($tg in $targets) { foreach ($tg in $targets) {
Write-Host "" Write-Host ""
Write-Host "=== server triage via $($tg.Label): $sshUser@$($tg.H):$($tg.P) ===" 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 } 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])" Write-Host " unreachable: $(($r.Out -split "`n")[0])"
$r = $null $r = $null
+11 -4
View File
@@ -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 } if (-not (Test-Path $doctor)) { Write-Host "gitea_doctor.ps1 not found; cannot repair the server."; return $false }
Write-Host "" Write-Host ""
Write-Host "=== gitea transport check/repair ($Why) ===" Write-Host "=== gitea transport check/repair ($Why) ==="
$dargs = @("-RepoUrl", $RepoUrl, "-Fix") # Hashtable splat, not an array: splatting an array passes every element
if ($AllowDestructive) { $dargs += "-AllowDestructive" } # positionally, so "-Fix" would be bound as a value (it lands on -SshTimeout).
& $doctor @dargs $dargs = @{ RepoUrl = $RepoUrl; Fix = $true }
$ok = ($LASTEXITCODE -eq 0) 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 "=== doctor $(if ($ok) { 'reports the transport healthy' } else { 'could NOT restore the transport' }) ==="
Write-Host "" Write-Host ""
return $ok return $ok