[PR #11991] [MERGED] core/vm's: ensure script state is sent on script exit #9899

Closed
opened 2026-02-26 17:32:09 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/11991
Author: @MickLesk
Created: 2/16/2026
Status: Merged
Merged: 2/16/2026
Merged by: @MickLesk

Base: mainHead: vm_error_handler


📝 Commits (3)

  • e089d60 Ensure API update is sent on script exit
  • a99bbb4 Update api.func
  • 4e90150 fix(telemetry): add missing exit codes to explain_exit_code()

📊 Changes

18 files changed (+184 additions, -13 deletions)

View changed files

📝 misc/api.func (+27 -0)
📝 misc/build.func (+9 -3)
📝 misc/error_handler.func (+23 -0)
📝 misc/vm-core.func (+12 -0)
📝 vm/archlinux-vm.sh (+8 -1)
📝 vm/debian-13-vm.sh (+8 -1)
📝 vm/debian-vm.sh (+8 -1)
📝 vm/haos-vm.sh (+9 -1)
📝 vm/mikrotik-routeros.sh (+8 -1)
📝 vm/nextcloud-vm.sh (+8 -1)
📝 vm/openwrt-vm.sh (+8 -0)
📝 vm/opnsense-vm.sh (+8 -1)
📝 vm/owncloud-vm.sh (+8 -1)
📝 vm/pimox-haos-vm.sh (+8 -1)
📝 vm/ubuntu2204-vm.sh (+8 -0)
📝 vm/ubuntu2404-vm.sh (+8 -0)
📝 vm/ubuntu2504-vm.sh (+8 -0)
📝 vm/umbrel-os-vm.sh (+8 -1)

📄 Description

✍️ Description

Add exit-time telemetry handling across scripts to avoid orphaned "installing" records. Introduce local exit_code capture in api_exit_script and cleanup handlers and, when POST_TO_API_DONE is true but POST_UPDATE_DONE is not, post a final status (marking failures on non-zero exit codes, or marking done/failed in VM cleanups based on exit code). Changes touch misc/build.func, misc/vm-core.func and various vm/*-vm.sh cleanup functions to reliably send post_update_to_api on normal or early exits.

Fixes #

Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE/pull/11991 **Author:** [@MickLesk](https://github.com/MickLesk) **Created:** 2/16/2026 **Status:** ✅ Merged **Merged:** 2/16/2026 **Merged by:** [@MickLesk](https://github.com/MickLesk) **Base:** `main` ← **Head:** `vm_error_handler` --- ### 📝 Commits (3) - [`e089d60`](https://github.com/community-scripts/ProxmoxVE/commit/e089d60d9e6eac228d59c0ff069fbee21c459991) Ensure API update is sent on script exit - [`a99bbb4`](https://github.com/community-scripts/ProxmoxVE/commit/a99bbb4e49ce08c53f0be5f6c4b4be70453fdc18) Update api.func - [`4e90150`](https://github.com/community-scripts/ProxmoxVE/commit/4e90150f88a7c642672690fd08d19f623f6db20c) fix(telemetry): add missing exit codes to explain_exit_code() ### 📊 Changes **18 files changed** (+184 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `misc/api.func` (+27 -0) 📝 `misc/build.func` (+9 -3) 📝 `misc/error_handler.func` (+23 -0) 📝 `misc/vm-core.func` (+12 -0) 📝 `vm/archlinux-vm.sh` (+8 -1) 📝 `vm/debian-13-vm.sh` (+8 -1) 📝 `vm/debian-vm.sh` (+8 -1) 📝 `vm/haos-vm.sh` (+9 -1) 📝 `vm/mikrotik-routeros.sh` (+8 -1) 📝 `vm/nextcloud-vm.sh` (+8 -1) 📝 `vm/openwrt-vm.sh` (+8 -0) 📝 `vm/opnsense-vm.sh` (+8 -1) 📝 `vm/owncloud-vm.sh` (+8 -1) 📝 `vm/pimox-haos-vm.sh` (+8 -1) 📝 `vm/ubuntu2204-vm.sh` (+8 -0) 📝 `vm/ubuntu2404-vm.sh` (+8 -0) 📝 `vm/ubuntu2504-vm.sh` (+8 -0) 📝 `vm/umbrel-os-vm.sh` (+8 -1) </details> ### 📄 Description <!--🛑 New scripts must be submitted to [ProxmoxVED](https://github.com/community-scripts/ProxmoxVED) for testing. PRs without prior testing will be closed. --> ## ✍️ Description Add exit-time telemetry handling across scripts to avoid orphaned "installing" records. Introduce local exit_code capture in api_exit_script and cleanup handlers and, when POST_TO_API_DONE is true but POST_UPDATE_DONE is not, post a final status (marking failures on non-zero exit codes, or marking done/failed in VM cleanups based on exit code). Changes touch misc/build.func, misc/vm-core.func and various vm/*-vm.sh cleanup functions to reliably send post_update_to_api on normal or early exits. ## 🔗 Related Issue Fixes # ## ✅ Prerequisites (**X** in brackets) - [x] **Self-review completed** – Code follows project standards. - [x] **Tested thoroughly** – Changes work as expected. - [x] **No security risks** – No hardcoded secrets, unnecessary privilege escalations, or permission issues. --- ## 🛠️ Type of Change (**X** in brackets) - [ ] 🐞 **Bug fix** – Resolves an issue without breaking functionality. - [ ] ✨ **New feature** – Adds new, non-breaking functionality. - [ ] 💥 **Breaking change** – Alters existing functionality in a way that may require updates. - [ ] 🆕 **New script** – A fully functional and tested script or script set. - [ ] 🌍 **Website update** – Changes to website-related JSON files or metadata. - [x] 🔧 **Refactoring / Code Cleanup** – Improves readability or maintainability without changing functionality. - [ ] 📝 **Documentation update** – Changes to `README`, `AppName.md`, `CONTRIBUTING.md`, or other docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 17:32:09 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE#9899
No description provided.