sos/0002-gcp-Catch-exceptions-when-PRODUCT_PATH-doesnt-exist.patch
Jan Jansky 6aa1fac3bd Update to 4.10.2-1
Resolves: RHEL-142635

Signed-off-by: Jan Jansky <jjansky@redhat.com>
2026-02-02 14:07:48 +01:00

37 lines
1.2 KiB
Diff

From 178d7fb1296dbcb744867d1b8a29678d1a3b0820 Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Mon, 26 Jan 2026 12:14:19 +0100
Subject: [PATCH] [gcp] Catch exceptions when PRODUCT_PATH doesnt exist
Catch exceptions when /sys/devices/virtual/dmi/id/product_name does not
exist on a (rare) system, while user manually enabled gcp plugin.
Closes: #4215
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
sos/report/plugins/gcp.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sos/report/plugins/gcp.py b/sos/report/plugins/gcp.py
index 24b50323..43ceec00 100644
--- a/sos/report/plugins/gcp.py
+++ b/sos/report/plugins/gcp.py
@@ -38,8 +38,11 @@ class GCP(Plugin, IndependentPlugin):
Checks if this plugin should be executed based on the presence of
GCE entry in sysfs.
"""
- with open(self.PRODUCT_PATH, encoding='utf-8') as sys_file:
- return "Google Compute Engine" in sys_file.read()
+ try:
+ with open(self.PRODUCT_PATH, encoding='utf-8') as sys_file:
+ return "Google Compute Engine" in sys_file.read()
+ except OSError:
+ return False
def setup(self):
"""
--
2.52.0