aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2018-07-31 21:08:13 -0400
committerBryn M. Reeves <bmr@redhat.com>2018-09-03 17:01:22 +0100
commit95f5fd634e9d5e373816a56352f41c0cfb2f7399 (patch)
treeb104e2ebfaae0da0808d27df21dbe44c08bea32c
parentb0fd6836a4f893a9fff666ac0c26f981ecb6b301 (diff)
downloadsos-95f5fd634e9d5e373816a56352f41c0cfb2f7399.tar.gz
[megacli] Correct MegaCli commands and enablement
The MegaCli64 command needs to be called using the full path to the binary. Also, correct the -ShowSummary adapter argument. Additionally, use the builtin 'files' check to enable the plugin only if the binary exists. Closes: #403 Resolves: #1392 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/megacli.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/sos/plugins/megacli.py b/sos/plugins/megacli.py
index 34d3be8e..f29aa830 100644
--- a/sos/plugins/megacli.py
+++ b/sos/plugins/megacli.py
@@ -9,8 +9,6 @@
#
# See the LICENSE file in the source distribution for further information.
-import os
-import os.path
from sos.plugins import Plugin, RedHatPlugin
@@ -20,21 +18,19 @@ class MegaCLI(Plugin, RedHatPlugin):
plugin_name = 'megacli'
profiles = ('system', 'storage', 'hardware')
+ files = ('/opt/MegaRAID/MegaCli/MegaCli64',)
def setup(self):
- if os.path.isfile("/opt/MegaRAID/MegaCli/MegaCli64"):
- self.add_custom_text("LSI MegaCLI is installed.<br>")
- self.get_megacli_files()
-
- def get_megacli_files(self):
- """ MegaCLI specific output
- """
+ cmd = '/opt/MegaRAID/MegaCli/MegaCli64'
+ subcmds = [
+ 'LDPDInfo',
+ '-AdpAllInfo',
+ '-AdpBbuCmd -GetBbuStatus',
+ '-ShowSummary'
+ ]
self.add_cmd_output([
- "MegaCli64 LDPDInfo -aALL",
- "MegaCli64 -AdpAllInfo -aALL",
- "MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL",
- "MegaCli64 -ShowSummary -a0"
+ "%s %s -aALL" % (cmd, subcmd) for subcmd in subcmds
])
# vim: set et ts=4 sw=4 :