iptag: fix syntax error in VM config file parsing (#10598)

* fix(iptag): Fix syntax error in VM config file parsing

The array assignment was using an invalid pipe construct inside the loop:
  vmids+=("${conf##*/}" | sed 's/\.conf$//')

This caused a bash syntax error:
  syntax error near unexpected token '2'

Fixed by using:
- shopt -s nullglob to handle empty directories gracefully
- Parameter expansion ${filename%.conf} instead of sed pipe

Fixes #10595

* fix(iptag): Fix syntax error in VM config file parsing

The array assignment was using an invalid pipe construct inside the loop:
  vmids+=("${conf##*/}" | sed 's/\.conf$//')

This caused a bash syntax error:
  syntax error near unexpected token '2'

Fixed by using parameter expansion ${basename%.conf} instead of sed pipe.

Fixes #10595
This commit is contained in:
CanbiZ (MickLesk)
2026-01-06 19:31:45 +01:00
committed by GitHub
parent 3f608cd7ea
commit d432d98723

View File

@@ -842,8 +842,10 @@ update_all_tags() {
else
# More efficient: direct file listing instead of ls+sed
vmids=()
for conf in /etc/pve/qemu-server/*.conf 2>/dev/null; do
[[ -f "$conf" ]] && vmids+=("${conf##*/}" | sed 's/\.conf$//')
for conf in /etc/pve/qemu-server/*.conf; do
[[ -f "$conf" ]] || continue
local basename="${conf##*/}"
vmids+=("${basename%.conf}")
done
fi