From d1a67b3bbbf1de8d72ae6eea409e86d51f5c5b2d Mon Sep 17 00:00:00 2001 From: MickLesk <47820557+MickLesk@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:25:34 +0100 Subject: [PATCH] AlmaLinux VM: report failures through the engine's error handler The script replaced the engine's error_handler with one that sent the failed command as the exit code, so every failure reached telemetry as exit 199 "exit code not reported", without the failed command or category. Its signal traps sent words instead of codes the same way. It also ran its own unguarded apt-get update for libguestfs-tools, so a host with the enterprise repository and no subscription (401) stopped there. vm_prepare_cloud_image installs the tools itself, tolerating a repository that fails to update. --- vm/almalinux-vm.sh | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/vm/almalinux-vm.sh b/vm/almalinux-vm.sh index 369115417..bec5526ef 100644 --- a/vm/almalinux-vm.sh +++ b/vm/almalinux-vm.sh @@ -24,18 +24,9 @@ THIN="discard=on,ssd=1," set -e trap 'error_handler $LINENO "$BASH_COMMAND"' ERR trap cleanup EXIT -trap 'post_update_to_api "failed" "INTERRUPTED"' SIGINT -trap 'post_update_to_api "failed" "TERMINATED"' SIGTERM - -function error_handler() { - local exit_code="$?" - local line_number="$1" - local command="$2" - local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" - post_update_to_api "failed" "${command}" - echo -e "\n$error_message\n" - cleanup_vmid -} +trap 'post_update_to_api "failed" "130"' SIGINT +trap 'post_update_to_api "failed" "143"' SIGTERM +trap 'post_update_to_api "failed" "129"; exit 129' SIGHUP TEMP_DIR=$(mktemp -d) pushd "$TEMP_DIR" >/dev/null @@ -126,16 +117,6 @@ post_to_api_vm vm_select_storage "$HN" -# ============================================================================== -# PREREQUISITES -# ============================================================================== -if ! command -v virt-customize &>/dev/null; then - msg_info "Installing libguestfs-tools" - $STD apt-get update - $STD apt-get install -y libguestfs-tools - msg_ok "Installed libguestfs-tools" -fi - msg_info "Retrieving the URL for the ${APP} Qcow2 Disk Image" ALMA_ARCH="$(vm_arch_resolve x86_64 aarch64)" URL="https://repo.almalinux.org/almalinux/${var_version}/cloud/${ALMA_ARCH}/images/AlmaLinux-${var_version}-GenericCloud-latest.${ALMA_ARCH}.qcow2"