aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2020-03-06 11:47:21 -0500
committerJake Hunsaker <jhunsake@redhat.com>2020-03-18 09:38:42 -0400
commit1b70c61d882036e72449e0fca8dd11cb7eb72bcb (patch)
tree32c1a984a1f58895366a1366ec34f2cc9844db1c
parentab1f4aafb3e06612f3a2c3b4630d288f5c7d7637 (diff)
downloadsos-1b70c61d882036e72449e0fca8dd11cb7eb72bcb.tar.gz
[pci] Do not run lspci commands when buses are not enumerated
From support team feedback, power systems may not have useful pci information. Now, gate `lspci` command collection behind the presence of bus directories under /proc/bus/pci. Related: #1975 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/plugins/pci.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/sos/plugins/pci.py b/sos/plugins/pci.py
index 83828d80..ac90f09d 100644
--- a/sos/plugins/pci.py
+++ b/sos/plugins/pci.py
@@ -7,6 +7,7 @@
# See the LICENSE file in the source distribution for further information.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
+import os
class Pci(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
@@ -23,7 +24,8 @@ class Pci(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"/proc/bus/pci"
])
- self.add_cmd_output("lspci -nnvv", root_symlink="lspci")
- self.add_cmd_output("lspci -tv")
+ if os.path.isdir("/proc/bus/pci/00"):
+ self.add_cmd_output("lspci -nnvv", root_symlink="lspci")
+ self.add_cmd_output("lspci -tv")
# vim: set et ts=4 sw=4 :