From 323931ae023c46370e200483a7c37959309cd9a4 Mon Sep 17 00:00:00 2001 From: Martin Kutlak Date: Tue, 21 May 2019 14:55:43 +0000 Subject: [PATCH] plugins: Catch unhandled exception in a-a-g-machine-id dmidecode can fail due to permission denies or any different reasons that causes dmidecode to return non-zero return code. Related: rhbz#1688368 cherry picked from commit 53100055cd504fa0d5d56eb9312ece66ba8de49e Signed-off-by: Martin Kutlak --- src/plugins/abrt-action-generate-machine-id | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/abrt-action-generate-machine-id b/src/plugins/abrt-action-generate-machine-id index f843d773..fc79b192 100644 --- a/src/plugins/abrt-action-generate-machine-id +++ b/src/plugins/abrt-action-generate-machine-id @@ -23,7 +23,7 @@ import os import sys from argparse import ArgumentParser -from subprocess import check_output +from subprocess import check_output, CalledProcessError import logging import hashlib @@ -52,7 +52,10 @@ def generate_machine_id_dmidecode(): # Run dmidecode command for k in keys: - data = check_output(["dmidecode", "-s", k]).strip() + try: + data = check_output(["dmidecode", "-s", k]).strip() + except (OSError, CalledProcessError) as ex: + raise RuntimeError("Execution of dmidecode failed: {0}".format(str(ex))) # Update the hash as we find the fields we are looking for machine_id.update(data) -- 2.21.0