diff options
-rw-r--r-- | sos/plugins/emc.py | 32 | ||||
-rw-r--r-- | sos/plugins/logs.py | 6 | ||||
-rw-r--r-- | sos/plugins/powerpc.py | 83 | ||||
-rw-r--r-- | sos/plugins/veritas.py | 2 | ||||
-rw-r--r-- | sos/sosreport.py | 32 |
5 files changed, 78 insertions, 77 deletions
diff --git a/sos/plugins/emc.py b/sos/plugins/emc.py index 89d0734e..6eac7d04 100644 --- a/sos/plugins/emc.py +++ b/sos/plugins/emc.py @@ -157,22 +157,22 @@ class Emc(Plugin, RedHatPlugin): ## If PowerPath is installed collect PowerPath specific information if self.is_installed("EMCpower"): - print "EMC PowerPath is installed." - print " Gathering EMC PowerPath information..." + print("EMC PowerPath is installed.") + print(" Gathering EMC PowerPath information...") self.add_custom_text("EMC PowerPath is installed.<br>") self.get_pp_files() add_about_emc = "yes" ## If PowerPath is running collect additional PowerPath specific information if os.path.isdir("/proc/emcp"): - print "EMC PowerPath is running." - print " Gathering additional EMC PowerPath information..." + print("EMC PowerPath is running.") + print(" Gathering additional EMC PowerPath information...") self.get_pp_config() ## If Solutions Enabler is installed collect Symmetrix/DMX specific information if len(self.policy().package_manager.all_pkgs_by_name_regex('[Ss][Yy][Mm][Cc][Ll][Ii]-[Ss][Yy][Mm][Cc][Ll][Ii]')) > 0: - print "EMC Solutions Enabler SYMCLI is installed." - print " Gathering EMC Solutions Enabler SYMCLI information..." + print("EMC Solutions Enabler SYMCLI is installed.") + print(" Gathering EMC Solutions Enabler SYMCLI information...") self.add_custom_text("EMC Solutions Enabler is installed.<br>") self.get_symcli_files() self.get_symcli_config() @@ -180,16 +180,16 @@ class Emc(Plugin, RedHatPlugin): ## If Navisphere Host Agent is installed collect CLARiiON specific information if os.path.isdir("/opt/Navisphere/bin"): - print "" - print "The EMC CLARiiON Navisphere Host Agent is installed." + print("") + print("The EMC CLARiiON Navisphere Host Agent is installed.") self.add_custom_text("EMC CLARiiON Navisphere Host Agent is installed.<br>") self.get_navicli_config() - print " Gathering Navisphere NAVICLI Host Agent information..." - print " Please enter a CLARiiON SP IP address. In order to collect" - print " information for both SPA and SPB as well as multiple" - print " CLARiiON arrays (if desired) you will be prompted multiple times." - print " To exit simply press [Enter]" - print "" + print(" Gathering Navisphere NAVICLI Host Agent information...") + print(" Please enter a CLARiiON SP IP address. In order to collect") + print( " information for both SPA and SPB as well as multiple") + print(" CLARiiON arrays (if desired) you will be prompted multiple times.") + print(" To exit simply press [Enter]") + print("") add_about_emc = "yes" CLARiiON_IP_address_list = [] CLARiiON_IP_loop = "stay_in" @@ -202,7 +202,7 @@ class Emc(Plugin, RedHatPlugin): CLARiiON_IP_address_list.append(ans) else: if ans != "": - print "The IP address you entered, %s, is not to an active CLARiiON SP." % 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 @@ -212,7 +212,7 @@ class Emc(Plugin, RedHatPlugin): 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 + print(" Gathering NAVICLI information for %s..." % SP_address) self.get_navicli_SP_info(SP_address) ## Only provide About EMC if EMC products are installed diff --git a/sos/plugins/logs.py b/sos/plugins/logs.py index 8359e063..bdf92067 100644 --- a/sos/plugins/logs.py +++ b/sos/plugins/logs.py @@ -38,14 +38,14 @@ class Logs(Plugin): self.add_copy_spec_limit("/var/log/boot*", sizelimit = self.limit) if self.get_option('all_logs'): - print "doing all_logs..." + print( "doing all_logs...") logs = self.do_regex_find_all("^\S+\s+(-?\/.*$)\s+", "/etc/syslog.conf") - print logs + print(logs) if self.policy().pkg_by_name("rsyslog") \ or os.path.exists("/etc/rsyslog.conf"): logs += self.do_regex_find_all("^\S+\s+(-?\/.*$)\s+", "/etc/rsyslog.conf") - print logs + print(logs) for i in logs: if i.startswith("-"): i = i[1:] diff --git a/sos/plugins/powerpc.py b/sos/plugins/powerpc.py index 974baa16..dfaacb9b 100644 --- a/sos/plugins/powerpc.py +++ b/sos/plugins/powerpc.py @@ -25,49 +25,50 @@ class PowerPC(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin): plugin_name = 'powerpc' def check_enabled(self): - return (self.policy().get_arch() == "ppc64") + return (self.policy().get_arch() == "ppc64") def setup(self): - try: - with open('/proc/cpuinfo', 'r') as fp: - contents = fp.read() - ispSeries = "pSeries" in contents - isPowerNV = "PowerNV" in contents - except: - ispSeries = False - isPowerNV = False + try: + with open('/proc/cpuinfo', 'r') as fp: + contents = fp.read() + ispSeries = "pSeries" in contents + isPowerNV = "PowerNV" in contents + except: + ispSeries = False + isPowerNV = False - if ispSeries or isPowerNV: - self.add_copy_spec("/proc/device-tree/") - self.add_copy_spec("/proc/loadavg") - self.add_copy_spec("/proc/locks") - self.add_copy_spec("/proc/misc") - self.add_copy_spec("/proc/swaps") - self.add_copy_spec("/proc/version") - self.add_copy_spec("/dev/nvram") - self.add_copy_spec("/var/log/platform") - self.add_cmd_output("ppc64_cpu --smt") - self.add_cmd_output("ppc64_cpu --cores-present") - self.add_cmd_output("ppc64_cpu --cores-on") - self.add_cmd_output("ppc64_cpu --run-mode") - self.add_cmd_output("ppc64_cpu --frequency") - self.add_cmd_output("ppc64_cpu --dscr") + if ispSeries or isPowerNV: + self.add_copy_spec("/proc/device-tree/") + self.add_copy_spec("/proc/loadavg") + self.add_copy_spec("/proc/locks") + self.add_copy_spec("/proc/misc") + self.add_copy_spec("/proc/swaps") + self.add_copy_spec("/proc/version") + self.add_copy_spec("/dev/nvram") + self.add_copy_spec("/var/log/platform") + self.add_cmd_output("ppc64_cpu --smt") + self.add_cmd_output("ppc64_cpu --cores-present") + self.add_cmd_output("ppc64_cpu --cores-on") + self.add_cmd_output("ppc64_cpu --run-mode") + self.add_cmd_output("ppc64_cpu --frequency") + self.add_cmd_output("ppc64_cpu --dscr") - if ispSeries: - self.add_copy_spec("/proc/ppc64/lparcfg") - self.add_copy_spec("/proc/ppc64/eeh") - self.add_copy_spec("/proc/ppc64/systemcfg") - self.add_cmd_output("lscfg -vp") - self.add_cmd_output("lsmcode -A") - self.add_cmd_output("lsvpd --debug") - self.add_cmd_output("lsvio -des") - self.add_cmd_output("servicelog --dump") - self.add_cmd_output("servicelog_notify --list") - self.add_cmd_output("usysattn") - self.add_cmd_output("usysident") - self.add_cmd_output("serv_config -l") - self.add_cmd_output("bootlist -m both -r") - self.add_cmd_output("lparstat -i") + if ispSeries: + self.add_copy_spec("/proc/ppc64/lparcfg") + self.add_copy_spec("/proc/ppc64/eeh") + self.add_copy_spec("/proc/ppc64/systemcfg") + self.add_cmd_output("lscfg -vp") + self.add_cmd_output("lsmcode -A") + self.add_cmd_output("lsvpd --debug") + self.add_cmd_output("lsvio -des") + self.add_cmd_output("servicelog --dump") + self.add_cmd_output("servicelog_notify --list") + self.add_cmd_output("usysattn") + self.add_cmd_output("usysident") + self.add_cmd_output("serv_config -l") + self.add_cmd_output("bootlist -m both -r") + self.add_cmd_output("lparstat -i") - if isPowerNV: - self.add_copy_spec("/proc/ppc64/") + if isPowerNV: + self.add_copy_spec("/proc/ppc64/") + diff --git a/sos/plugins/veritas.py b/sos/plugins/veritas.py index 176e1d16..4a2ce572 100644 --- a/sos/plugins/veritas.py +++ b/sos/plugins/veritas.py @@ -38,5 +38,5 @@ class Veritas(Plugin, RedHatPlugin): tarfile = self.do_regex_find_all(r"ftp (.*tar.gz)", line) if len(tarfile) == 1: self.add_copy_spec(tarfile[0]) - except AttributeError, e: + except AttributeError as e: self.add_alert(e) diff --git a/sos/sosreport.py b/sos/sosreport.py index 2451439b..40183ad4 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -70,11 +70,11 @@ class TempFileUtil(object): try: f.flush() f.close() - except Exception, e: + except Exception as e: pass try: os.unlink(fname) - except Exception, e: + except Exception as e: pass self.files = [] @@ -84,15 +84,15 @@ class OptionParserExtended(OptionParser): def print_help(self, out=sys.stdout): """ Prints help content including examples """ OptionParser.print_help(self, out) - print - print "Some examples:" - print - print " enable cluster plugin only and collect dlm lockdumps:" - print " # sosreport -o cluster -k cluster.lockdump" - print - print " disable memory and samba plugins, turn off rpm -Va collection:" - print " # sosreport -n memory,samba -k rpm.rpmva=off" - print + print() + print( "Some examples:") + print() + print( " enable cluster plugin only and collect dlm lockdumps:") + print( " # sosreport -o cluster -k cluster.lockdump") + print() + print( " disable memory and samba plugins, turn off rpm -Va collection:") + print( " # sosreport -n memory,samba -k rpm.rpmva=off") + print() class SosOption(Option): """Allow to specify comma delimited list of plugins""" @@ -580,9 +580,9 @@ class SoSReport(object): self.archive = TarFileArchive(archive_name, self.tmpdir) def _make_archive_paths(self): - self.archive.makedirs(self.cmddir, 0755) - self.archive.makedirs(self.logdir, 0755) - self.archive.makedirs(self.rptdir, 0755) + self.archive.makedirs(self.cmddir, 0o755) + self.archive.makedirs(self.logdir, 0o755) + self.archive.makedirs(self.rptdir, 0o755) def _set_directories(self): self.cmddir = 'sos_commands' @@ -784,7 +784,7 @@ class SoSReport(object): continue self._load(plugin_class) - except Exception, e: + except Exception as e: self.soslog.warning(_("plugin %s does not install, skipping: %s") % (plug, e)) if self.raise_plugins: raise @@ -927,7 +927,7 @@ class SoSReport(object): self.policy.pre_work() self._set_archive() self._make_archive_paths() - except Exception, e: + except Exception as e: import traceback traceback.print_exc(e) self.ui_log.info(e) |