aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2021-04-09 17:16:19 -0400
committerJake Hunsaker <jhunsake@redhat.com>2021-04-12 12:34:39 -0400
commit9191c690a3311b81eeb3480d4f054e93d1ce75e3 (patch)
treeb646e877197b81663ce9f01cac9bd6370d9f6e72
parent29afda6e4ff90385d34bc61315542e7cb4baaf8d (diff)
downloadsos-9191c690a3311b81eeb3480d4f054e93d1ce75e3.tar.gz
[ata] Convert to using add_blockdev_cmd()
Converts the `ata` plugin to using the `add_block_dev()` method instead of generating it's own list of device paths. Closes: #2430 Resolves: #2481 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/report/plugins/ata.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/sos/report/plugins/ata.py b/sos/report/plugins/ata.py
index 6e1b7641..ed188e07 100644
--- a/sos/report/plugins/ata.py
+++ b/sos/report/plugins/ata.py
@@ -7,7 +7,6 @@
# See the LICENSE file in the source distribution for further information.
from sos.report.plugins import Plugin, IndependentPlugin
-import os
class Ata(Plugin, IndependentPlugin):
@@ -20,18 +19,13 @@ class Ata(Plugin, IndependentPlugin):
packages = ('hdparm', 'smartmontools')
def setup(self):
- dev_path = '/dev'
- sys_block = '/sys/block'
self.add_copy_spec('/proc/ide')
- if os.path.isdir(sys_block):
- for disk in os.listdir(sys_block):
- if disk.startswith("sd") or disk.startswith("hd"):
- disk_path = os.path.join(dev_path, disk)
- self.add_cmd_output([
- "hdparm %s" % disk_path,
- "smartctl -a %s" % disk_path,
- "smartctl -l scterc %s" % disk_path,
- ])
+ cmd_list = [
+ "hdparm %(dev)s",
+ "smartctl -a %(dev)s",
+ "smartctl -l scterc %(dev)s"
+ ]
+ self.add_blockdev_cmd(cmd_list, whitelist=['sd.*', 'hd.*'])
# vim: set et ts=4 sw=4 :