forked from Fediversity/Fediversity
WIP: test data model thru VM #11
1 changed files with 14 additions and 1 deletions
|
@ -122,14 +122,27 @@ in
|
|||
sshOpts=(
|
||||
-o BatchMode=yes
|
||||
-o StrictHostKeyChecking=no
|
||||
-o "ConnectionAttempts=1"
|
||||
-o "ConnectTimeout=1"
|
||||
-o "ServerAliveCountMax=1"
|
||||
-o "ServerAliveInterval=1"
|
||||
)
|
||||
# get the realized derivation to deploy
|
||||
outPath=$(nix-store --realize "$drv_path")
|
||||
# deploy the config by nix-copy-closure
|
||||
NIX_SSHOPTS="''${sshOpts[*]}" nix-copy-closure --to "$host" "$outPath" --gzip --use-substitutes
|
||||
# switch the remote host to the config
|
||||
ssh "''${sshOpts[@]}" "$host" "nix-env --profile /nix/var/nix/profiles/system --set $outPath; $outPath/bin/switch-to-configuration switch"
|
||||
output=$(ssh "''${sshOpts[@]}" "$host" "nix-env --profile /nix/var/nix/profiles/system --set $outPath; nohup $outPath/bin/switch-to-configuration switch &" 2>&1) || echo "status code: $?"
|
||||
echo "output: $output"
|
||||
if [[ $output != *"Timeout, server ${nodeName} not responding"* ]]; then
|
||||
echo "non-timeout error: $output"
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
""")
|
||||
${nodeName}.wait_for_unit("multi-user.target")
|
||||
${nodeName}.succeed("systemctl is-active sshd")
|
||||
${nodeName}.succeed("${nodeName} 1>&2")
|
||||
'') targetMachines
|
||||
)}
|
||||
|
|
Loading…
Add table
Reference in a new issue