Fix proxy installer dedupe
This commit is contained in:
parent
de5b314842
commit
871c2988ff
2 changed files with 41 additions and 2 deletions
|
|
@ -1576,7 +1576,7 @@ fi'; then
|
||||||
local_proxy_binary="/tmp/pulse-sensor-proxy-$CTID"
|
local_proxy_binary="/tmp/pulse-sensor-proxy-$CTID"
|
||||||
print_info "Copying locally-built pulse-sensor-proxy binary from container..."
|
print_info "Copying locally-built pulse-sensor-proxy binary from container..."
|
||||||
if pct pull $CTID /opt/pulse/bin/pulse-sensor-proxy "$local_proxy_binary" 2>/dev/null; then
|
if pct pull $CTID /opt/pulse/bin/pulse-sensor-proxy "$local_proxy_binary" 2>/dev/null; then
|
||||||
proxy_install_args=(--ctid "$CTID" --local-binary "$local_proxy_binary" --skip-restart)
|
proxy_install_args=(--ctid "$CTID" --local-binary "$local_proxy_binary" --skip-restart --pulse-server "http://${IP}:${frontend_port}")
|
||||||
print_info "Using locally-built binary from container"
|
print_info "Using locally-built binary from container"
|
||||||
else
|
else
|
||||||
print_warn "Failed to copy binary from container, will try fallback download"
|
print_warn "Failed to copy binary from container, will try fallback download"
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,46 @@ update_allowed_nodes() {
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove any existing allowed_nodes block (including descriptive comments) to prevent duplicates
|
# Remove any existing allowed_nodes block (including descriptive comments) to prevent duplicates
|
||||||
perl -0pi -e 's/(?:^[ \t]*#[^\n]*\n)*allowed_nodes:\n(?:(?:[ \t]+-[^\n]*|[ \t]*#[^\n]*)\n)*//mg' "$config_file" 2>/dev/null || true
|
local tmp_config
|
||||||
|
tmp_config=$(mktemp)
|
||||||
|
if awk '
|
||||||
|
BEGIN { skip=0; pending_count=0 }
|
||||||
|
function flush_pending() {
|
||||||
|
for (i=1; i<=pending_count; i++) print pending[i]
|
||||||
|
pending_count=0
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if (skip) {
|
||||||
|
if ($0 ~ /^[[:space:]]*$/ || $0 ~ /^[[:space:]]*#/ || $0 ~ /^[[:space:]]*-[[:space:]]*/) {
|
||||||
|
next
|
||||||
|
}
|
||||||
|
skip=0
|
||||||
|
}
|
||||||
|
if ($0 ~ /^[[:space:]]*allowed_nodes:[[:space:]]*$/) {
|
||||||
|
pending_count=0
|
||||||
|
skip=1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
if ($0 ~ /^[[:space:]]*$/ || $0 ~ /^[[:space:]]*#/) {
|
||||||
|
pending[++pending_count]=$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
if (pending_count > 0) {
|
||||||
|
flush_pending()
|
||||||
|
}
|
||||||
|
print
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
if (!skip && pending_count > 0) {
|
||||||
|
flush_pending()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
' "$config_file" > "$tmp_config"; then
|
||||||
|
mv "$tmp_config" "$config_file"
|
||||||
|
else
|
||||||
|
rm -f "$tmp_config"
|
||||||
|
print_warn "Failed to sanitize existing allowed_nodes block; duplicates may remain"
|
||||||
|
fi
|
||||||
|
|
||||||
{
|
{
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue