sos/SOURCES/sos-bz1457191-navicli-nonit...

68 lines
2.5 KiB
Diff

From ca24d4602ce46312343f1f6c6f4b270fb6092e21 Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Wed, 15 Apr 2020 17:09:52 +0200
Subject: [PATCH] [navicli] replace interactive prompt by plugin option
List of ClariiOn IP addresses should be provided via
-k navicli.ipaddrs plugopt, as a space separated list.
Closes: #405
Resolves: #2020
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
---
sos/plugins/navicli.py | 30 +++++-------------------------
1 file changed, 5 insertions(+), 25 deletions(-)
diff --git a/sos/plugins/navicli.py b/sos/plugins/navicli.py
index 8e5dee50..5b6d766d 100644
--- a/sos/plugins/navicli.py
+++ b/sos/plugins/navicli.py
@@ -19,6 +19,8 @@ class Navicli(Plugin, RedHatPlugin):
plugin_name = 'navicli'
profiles = ('storage', 'hardware')
+ option_list = [("ipaddrs", "list of space separated CLARiiON IP addresses",
+ '', "")]
def check_enabled(self):
return is_executable("navicli")
@@ -57,30 +59,8 @@ class Navicli(Plugin, RedHatPlugin):
def setup(self):
self.get_navicli_config()
- CLARiiON_IP_address_list = []
- CLARiiON_IP_loop = "stay_in"
- while CLARiiON_IP_loop == "stay_in":
- try:
- ans = input("CLARiiON SP IP Address or [Enter] to exit: ")
- except Exception:
- return
- if self.exec_cmd("navicli -h %s getsptime" % (ans,))['status']:
- CLARiiON_IP_address_list.append(ans)
- else:
- if ans != "":
- print("The IP address you entered, %s, is not to an "
- "active CLARiiON SP." % ans)
- if ans == "":
- CLARiiON_IP_loop = "get_out"
- # Sort and dedup the list of CLARiiON IP Addresses
- CLARiiON_IP_address_list.sort()
- for SP_address in CLARiiON_IP_address_list:
- if CLARiiON_IP_address_list.count(SP_address) > 1:
- CLARiiON_IP_address_list.remove(SP_address)
- for SP_address in CLARiiON_IP_address_list:
- if SP_address != "":
- print(" Gathering NAVICLI information for %s..." %
- SP_address)
- self.get_navicli_SP_info(SP_address)
+ for ip in set(self.get_option("ipaddrs").split()):
+ if self.exec_cmd("navicli -h %s getsptime" % (ip))['status'] == 0:
+ self.get_navicli_SP_info(ip)
# vim: set et ts=4 sw=4 :
--
2.21.3