deploy: use xin-status to get host status info

This commit is contained in:
Aaron Bieber 2022-10-26 16:34:54 -06:00
parent c379b6237f
commit 8729210d8e
No known key found for this signature in database

5
deploy
View File

@ -41,9 +41,10 @@ if [ "$1" = "status" ]; then
continue continue
fi fi
echo -n "===> $h: " echo -n "===> $h: "
host_data="$(${SSH} root@${host} 'nixos-version --json')" host_data="$(${SSH} root@${host} 'xin-status')"
remote_rev=$(echo $host_data | jq -r .configurationRevision) remote_rev=$(echo $host_data | jq -r .configurationRevision)
remote_ver=$(echo $host_data | jq -r .nixosVersion) remote_ver=$(echo $host_data | jq -r .nixosVersion)
needs_reboot=$(echo $host_data | jq -r .needs_restart)
rev_msg="DIRTY" rev_msg="DIRTY"
rev_status="✓" rev_status="✓"
if [ "$remote_rev" != "DIRTY" ]; then if [ "$remote_rev" != "DIRTY" ]; then
@ -53,7 +54,7 @@ if [ "$1" = "status" ]; then
fi fi
fi fi
echo -en "\t\t${remote_ver}\t${rev_status}\t(${rev_msg})" echo -en "\t\t${remote_ver}\t${rev_status}\t(${rev_msg})"
if ${SSH} root@$host 'check-restart' >/dev/null 2>&1; then if [ "$needs_reboot" == "false" ]; then
echo -e "\tOK" echo -e "\tOK"
else else
echo -e "\tREBOOT" echo -e "\tREBOOT"