mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-18 00:17:43 +01:00
fix: persist diagnostics opt-in inside containers for addon telemetry
- install.func + alpine-install.func: create /usr/local/community-scripts/diagnostics inside the container when DIAGNOSTICS=yes (from build.func export) - Enables addon scripts running later inside containers to find the opt-in - Update init_tool_telemetry default type from 'tool' to 'pve'
This commit is contained in:
@@ -11,6 +11,13 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
|
||||
load_functions
|
||||
catch_errors
|
||||
|
||||
# Persist diagnostics opt-in inside container (exported from build.func)
|
||||
# so addon scripts running later can find it
|
||||
if [[ "${DIAGNOSTICS:-no}" == "yes" ]] && [[ ! -f /usr/local/community-scripts/diagnostics ]]; then
|
||||
mkdir -p /usr/local/community-scripts
|
||||
echo "DIAGNOSTICS=yes" >/usr/local/community-scripts/diagnostics
|
||||
fi
|
||||
|
||||
# Get LXC IP address (must be called INSIDE container, after network is up)
|
||||
get_lxc_ip
|
||||
|
||||
|
||||
@@ -1018,19 +1018,20 @@ _telemetry_report_exit() {
|
||||
#
|
||||
# - One-line telemetry setup for tools/addon scripts
|
||||
# - Reads DIAGNOSTICS from /usr/local/community-scripts/diagnostics
|
||||
# (persisted on PVE host during first build, and inside containers by install.func)
|
||||
# - Starts install timer for duration tracking
|
||||
# - Sets EXIT trap to automatically report success/failure on script exit
|
||||
# - Arguments:
|
||||
# * $1: tool_name (optional, falls back to $APP at exit time)
|
||||
# * $2: type ("tool" for PVE host scripts, "addon" for container addons)
|
||||
# * $2: type ("pve" for PVE host scripts, "addon" for container addons)
|
||||
# - Usage:
|
||||
# source <(curl -fsSL .../misc/api.func) 2>/dev/null || true
|
||||
# init_tool_telemetry "post-pve-install" "tool"
|
||||
# init_tool_telemetry "post-pve-install" "pve"
|
||||
# init_tool_telemetry "" "addon" # uses $APP at exit time
|
||||
# ------------------------------------------------------------------------------
|
||||
init_tool_telemetry() {
|
||||
local name="${1:-}"
|
||||
local type="${2:-tool}"
|
||||
local type="${2:-pve}"
|
||||
|
||||
[[ -n "$name" ]] && TELEMETRY_TOOL_NAME="$name"
|
||||
TELEMETRY_TOOL_TYPE="$type"
|
||||
|
||||
@@ -37,6 +37,13 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
|
||||
load_functions
|
||||
catch_errors
|
||||
|
||||
# Persist diagnostics opt-in inside container (exported from build.func)
|
||||
# so addon scripts running later can find it
|
||||
if [[ "${DIAGNOSTICS:-no}" == "yes" ]] && [[ ! -f /usr/local/community-scripts/diagnostics ]]; then
|
||||
mkdir -p /usr/local/community-scripts
|
||||
echo "DIAGNOSTICS=yes" >/usr/local/community-scripts/diagnostics
|
||||
fi
|
||||
|
||||
# Get LXC IP address (must be called INSIDE container, after network is up)
|
||||
get_lxc_ip
|
||||
|
||||
|
||||
Reference in New Issue
Block a user