mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-18 00:12:17 +00:00
Turnkey: modernize turnkey.sh with shared libraries (#13242)
* refactor(turnkey): modernize turnkey.sh with shared libraries and telemetry - Source core.func, error_handler.func, api.func instead of custom error/msg functions - Replace custom error_exit/warn/info/msg with msg_info/msg_ok/msg_error/msg_warn - Upgrade validate_container_id to cluster-aware (pvesh + all-node config check) - Add diagnostics_check() and telemetry (post_to_api / post_update_to_api) - Add pve_check, shell_check, root_check for environment validation - Use proper EXIT trap for cleanup (destroy container on error, restart monitor) - Improve quoting throughout (PCT_OPTIONS as array, quoted variables) - Secure credentials file with chmod 600 - Use exit_script for user cancellations (consistent with other scripts) * fix(turnkey): replace diagnostics_check with inline config read diagnostics_check() is defined in build.func which is not sourced. Read the diagnostics config file directly instead — respects existing user preference without prompting (turnkey has no settings menu). * bump hardcoded names to dynamic list * Preserve telemetry type and report failures Respect a pre-set TELEMETRY_TYPE in misc/api.func and use it in the API payload instead of the hardcoded "lxc". In turnkey/turnkey.sh, set TELEMETRY_TYPE="turnkey" for turnkey installs and enhance turnkey_cleanup() to report failed installs to telemetry (calls post_update_to_api "failed" with the exit code when POST_TO_API_DONE is true and POST_UPDATE_DONE is not), then destroy the failed container. These changes ensure correct telemetry type propagation and that failed turnkey deployments are reported. --------- Co-authored-by: Slaviša Arežina <58952836+tremor021@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0980a85021
commit
1c3c223e51
@@ -664,7 +664,7 @@ post_to_api() {
|
||||
{
|
||||
"random_id": "${RANDOM_UUID}",
|
||||
"execution_id": "${EXECUTION_ID:-${RANDOM_UUID}}",
|
||||
"type": "lxc",
|
||||
"type": "${TELEMETRY_TYPE}",
|
||||
"nsapp": "${NSAPP:-unknown}",
|
||||
"status": "installing",
|
||||
"ct_type": ${CT_TYPE:-1},
|
||||
|
||||
Reference in New Issue
Block a user