diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2020-04-15 17:09:52 +0200 |
---|---|---|
committer | Bryan Quigley <bryan.quigley@canonical.com> | 2020-04-16 11:43:50 -0700 |
commit | ca24d4602ce46312343f1f6c6f4b270fb6092e21 (patch) | |
tree | cc1b492fa84f3c6253211dd29c7ee5e1ee4baffc | |
parent | d855af764b81cf846e1672510646cebf3cc23403 (diff) | |
download | sos-ca24d4602ce46312343f1f6c6f4b270fb6092e21.tar.gz |
[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>
-rw-r--r-- | sos/report/plugins/navicli.py | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/sos/report/plugins/navicli.py b/sos/report/plugins/navicli.py index 8e5dee50..5b6d766d 100644 --- a/sos/report/plugins/navicli.py +++ b/sos/report/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 : |