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