From 1db68f32b5f8324f21a0fea084c80caf74b47781 Mon Sep 17 00:00:00 2001 From: Dereck Date: Thu, 12 Mar 2026 00:45:49 -0400 Subject: [PATCH] Address second CodeRabbit review feedback - Quote $VMID in error_handler for robustness - Reduce port 11443 wait loop from 15min to 5min and update message --- vm/unifi-os-server-vm.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vm/unifi-os-server-vm.sh b/vm/unifi-os-server-vm.sh index b618788a..1c36bf34 100644 --- a/vm/unifi-os-server-vm.sh +++ b/vm/unifi-os-server-vm.sh @@ -81,7 +81,7 @@ function error_handler() { local command="$2" post_update_to_api "failed" "${command}" echo -e "\n${RD}[ERROR]${CL} line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing ${YW}$command${CL}\n" - if [ -n "${VMID:-}" ] && qm status $VMID &>/dev/null; then qm stop $VMID &>/dev/null || true; fi + if [ -n "${VMID:-}" ] && qm status "$VMID" &>/dev/null; then qm stop "$VMID" &>/dev/null || true; fi } function get_valid_nextid() { @@ -990,14 +990,14 @@ if [ "$START_VM" == "yes" ]; then # Wait for UniFi OS to be ready on port 11443 if [ -n "$VM_IP" ]; then - msg_info "Waiting for UniFi OS to start on https://${VM_IP}:11443" + msg_info "Waiting for UniFi OS to start on https://${VM_IP}:11443 (may take several minutes)" UNIFI_READY="" - for i in {1..180}; do + for i in {1..60}; do if curl -skI --max-time 3 "https://${VM_IP}:11443" &>/dev/null; then UNIFI_READY="yes" break fi - printf "\r${TAB}${YW}${HOLD}Waiting for UniFi OS to start on https://${VM_IP}:11443 [%ds]${HOLD}" "$((i * 5))" + printf "\r${TAB}${YW}${HOLD}Waiting for UniFi OS to start on https://${VM_IP}:11443 (may take several minutes) [%ds]${HOLD}" "$((i * 5))" sleep 5 done