fix(agent99): bind host112 apply to immutable receipt
This commit is contained in:
@@ -195,6 +195,16 @@ try {
|
||||
|
||||
$config = Get-Content $ConfigPath -Raw | ConvertFrom-Json
|
||||
Add-DefaultProperty $config "sshIdentityFile" (Join-Path $AgentRoot "keys\agent99_ed25519")
|
||||
Add-DefaultProperty $config "sshUsers" ([pscustomobject]@{})
|
||||
$previousHost112User = if ($config.sshUsers.PSObject.Properties["192.168.0.112"]) { [string]$config.sshUsers.PSObject.Properties["192.168.0.112"].Value } else { "" }
|
||||
if ($previousHost112User -ne "kali") {
|
||||
Set-AgentProperty $config.sshUsers "192.168.0.112" "kali"
|
||||
$script:ConfigMigrations += [pscustomobject]@{
|
||||
name = "host112_canonical_ssh_user"
|
||||
from = if ($previousHost112User) { $previousHost112User } else { "missing" }
|
||||
to = "kali"
|
||||
}
|
||||
}
|
||||
Add-DefaultProperty $config "sshTransport" ([pscustomobject]@{})
|
||||
Add-DefaultProperty $config.sshTransport "serialized" $true
|
||||
Add-DefaultProperty $config.sshTransport "lockTimeoutSeconds" 90
|
||||
@@ -207,6 +217,15 @@ try {
|
||||
Add-DefaultProperty $config.k3s "jumpHost" "192.168.0.110"
|
||||
Add-DefaultProperty $config.k3s "preferJumpHost" $true
|
||||
Add-DefaultProperty $config.k3s "directHosts" @("192.168.0.110", "192.168.0.112")
|
||||
$directHosts = @($config.k3s.directHosts | ForEach-Object { [string]$_ } | Where-Object { $_ })
|
||||
if ("192.168.0.112" -notin $directHosts) {
|
||||
Set-AgentProperty $config.k3s "directHosts" @($directHosts + "192.168.0.112" | Select-Object -Unique)
|
||||
$script:ConfigMigrations += [pscustomobject]@{
|
||||
name = "host112_canonical_direct_route"
|
||||
from = ($directHosts -join ",")
|
||||
to = ((@($directHosts + "192.168.0.112") | Select-Object -Unique) -join ",")
|
||||
}
|
||||
}
|
||||
Add-DefaultProperty $config "autoRecovery" ([pscustomobject]@{})
|
||||
Add-DefaultProperty $config.autoRecovery "enabled" $true
|
||||
Add-DefaultProperty $config.autoRecovery "triggerOnHostUnreachable" $true
|
||||
@@ -259,6 +278,12 @@ try {
|
||||
}
|
||||
}
|
||||
$config | ConvertTo-Json -Depth 20 | Set-Content -Path $ConfigPath -Encoding UTF8
|
||||
$persistedConfig = Get-Content $ConfigPath -Raw | ConvertFrom-Json
|
||||
$persistedHost112User = if ($persistedConfig.sshUsers -and $persistedConfig.sshUsers.PSObject.Properties["192.168.0.112"]) { [string]$persistedConfig.sshUsers.PSObject.Properties["192.168.0.112"].Value } else { "" }
|
||||
$persistedDirectHosts = if ($persistedConfig.k3s -and $persistedConfig.k3s.PSObject.Properties["directHosts"]) { @($persistedConfig.k3s.directHosts | ForEach-Object { [string]$_ }) } else { @() }
|
||||
if ($persistedHost112User -ne "kali" -or "192.168.0.112" -notin $persistedDirectHosts) {
|
||||
throw "Host112 canonical direct SSH config post-verifier failed."
|
||||
}
|
||||
|
||||
$manifestRows = @()
|
||||
foreach ($staged in $stagedFiles) {
|
||||
|
||||
Reference in New Issue
Block a user