ssh: fix LXC name parsing in deploy-keys.sh (Lock column edge case)

This commit is contained in:
2026-06-02 00:06:58 +02:00
parent 5adb66237e
commit 00a891b154
29 changed files with 90 additions and 32 deletions

View File

@@ -49,8 +49,15 @@ echo " hubris: $added key(s) added"
echo ""
echo "= Deploying SSH keys to LXCs ="
# pct list output: VMID Status Lock Name
pct list | tail -n +2 | while read -r vmid status _ name; do
# pct list output: VMID Status Lock Name (Lock may be empty)
# Use awk to grab VMID, Status, and Name (last field)
pct list | tail -n +2 | while read -r line; do
vmid=$(echo "$line" | awk '{print $1}')
status=$(echo "$line" | awk '{print $2}')
name=$(echo "$line" | awk '{print $NF}')
# Skip header if any
[ "$vmid" = "VMID" ] && continue
[ -z "$vmid" ] && continue
if [ "$status" != "running" ]; then
echo " SKIP $name ($vmid): status=$status"
continue