aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPonnuvel Palaniyappan <pponnuvel@gmail.com>2024-03-02 12:57:40 +0000
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-03-18 11:50:07 -0400
commit6112224463c29a96a891e21ce911950fb14d903c (patch)
treed6013943b01b61345dd26d143fc6349d34e8b866
parent36bfd6ddfc67774e7303899750726995d86de005 (diff)
downloadsos-6112224463c29a96a891e21ce911950fb14d903c.tar.gz
[plugins] Fix Pylint and PEP8 issues - part4
Continuation of #3530. Likewise excludes C0114, C0115, and C0209. Signed-off-by: Ponnuvel Palaniyappan <pponnuvel@gmail.com>
-rw-r--r--sos/report/plugins/pacemaker.py17
-rw-r--r--sos/report/plugins/pcp.py28
-rw-r--r--sos/report/plugins/peripety.py2
-rw-r--r--sos/report/plugins/pmem.py47
-rw-r--r--sos/report/plugins/postfix.py38
-rw-r--r--sos/report/plugins/postgresql.py9
-rw-r--r--sos/report/plugins/powerpc.py19
-rw-r--r--sos/report/plugins/psacct.py4
-rw-r--r--sos/report/plugins/pulp.py24
-rw-r--r--sos/report/plugins/pulpcore.py25
-rw-r--r--sos/report/plugins/puppet.py3
-rw-r--r--sos/report/plugins/pxe.py4
-rw-r--r--sos/report/plugins/python.py15
-rw-r--r--sos/report/plugins/qpid_dispatch.py2
-rw-r--r--sos/report/plugins/radius.py4
-rw-r--r--sos/report/plugins/release.py4
-rw-r--r--sos/report/plugins/rhv_analyzer.py2
-rw-r--r--sos/report/plugins/s390.py10
-rw-r--r--sos/report/plugins/saltmaster.py6
-rw-r--r--sos/report/plugins/samba.py2
-rw-r--r--sos/report/plugins/sanlock.py3
-rw-r--r--sos/report/plugins/saphana.py7
-rw-r--r--sos/report/plugins/sapnw.py43
-rw-r--r--sos/report/plugins/sar.py35
-rw-r--r--sos/report/plugins/sas3ircu.py2
-rw-r--r--sos/report/plugins/scsi.py2
-rw-r--r--sos/report/plugins/sedutil.py1
-rw-r--r--sos/report/plugins/sendmail.py4
-rw-r--r--sos/report/plugins/services.py4
-rw-r--r--sos/report/plugins/shmcli.py37
-rw-r--r--sos/report/plugins/skydive.py2
-rw-r--r--sos/report/plugins/slurm.py4
-rw-r--r--sos/report/plugins/smclient.py1
-rw-r--r--sos/report/plugins/snap.py5
-rw-r--r--sos/report/plugins/snmp.py5
-rw-r--r--sos/report/plugins/sos_extras.py18
-rw-r--r--sos/report/plugins/soundcard.py6
-rw-r--r--sos/report/plugins/ssh.py11
-rw-r--r--sos/report/plugins/sssd.py8
-rw-r--r--sos/report/plugins/subscription_manager.py10
-rw-r--r--sos/report/plugins/system.py1
-rw-r--r--sos/report/plugins/tomcat.py8
-rw-r--r--sos/report/plugins/ufw.py2
-rw-r--r--sos/report/plugins/unity.py2
-rw-r--r--sos/report/plugins/unpackaged.py29
-rw-r--r--sos/report/plugins/vault.py4
-rw-r--r--sos/report/plugins/vdsm.py11
-rw-r--r--sos/report/plugins/veritas.py6
-rw-r--r--sos/report/plugins/vhostmd.py13
-rw-r--r--sos/report/plugins/virsh.py16
-rw-r--r--sos/report/plugins/watchdog.py5
-rw-r--r--sos/report/plugins/xen.py15
-rw-r--r--sos/report/plugins/xfs.py4
-rw-r--r--sos/report/plugins/zvm.py10
54 files changed, 301 insertions, 298 deletions
diff --git a/sos/report/plugins/pacemaker.py b/sos/report/plugins/pacemaker.py
index 113691e1..b8fe47ae 100644
--- a/sos/report/plugins/pacemaker.py
+++ b/sos/report/plugins/pacemaker.py
@@ -6,11 +6,11 @@
#
# See the LICENSE file in the source distribution for further information.
+import re
+from datetime import datetime, timedelta
from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin,
UbuntuPlugin, PluginOpt)
from sos.utilities import sos_parse_version
-from datetime import datetime, timedelta
-import re
class Pacemaker(Plugin):
@@ -34,15 +34,18 @@ class Pacemaker(Plugin):
envfile = ""
def setup_crm_mon(self):
+ """ Get cluster summary """
self.add_cmd_output("crm_mon -1 -A -n -r -t")
def setup_crm_shell(self):
+ """ Get cluster status and configuration """
self.add_cmd_output([
"crm status",
"crm configure show",
])
def setup_pcs(self):
+ """ Get pacemaker/corosync configuration """
pcs_pkg = self.policy.package_manager.pkg_by_name('pcs')
if pcs_pkg is None:
return
@@ -65,6 +68,7 @@ class Pacemaker(Plugin):
self.add_cmd_output("pcs status --full", tags="pcs_status")
def postproc_crm_shell(self):
+ """ Clear password """
self.do_cmd_output_sub(
"crm configure show",
r"passw([^\s=]*)=\S+",
@@ -72,6 +76,7 @@ class Pacemaker(Plugin):
)
def postproc_pcs(self):
+ """ Clear password """
self.do_cmd_output_sub(
"pcs config",
r"passw([^\s=]*)=\S+",
@@ -128,8 +133,8 @@ class Pacemaker(Plugin):
pattern = r'^\s*PCMK_logfile=[\'\"]?(\S+)[\'\"]?\s*(\s#.*)?$'
if self.path_isfile(self.envfile):
self.add_copy_spec(self.envfile)
- with open(self.envfile) as f:
- for line in f:
+ with open(self.envfile, 'r', encoding='UTF-8') as file:
+ for line in file:
if re.match(pattern, line):
# remove trailing and leading quote marks, in case the
# line is e.g. PCMK_logfile="/var/log/pacemaker.log"
@@ -144,7 +149,7 @@ class DebianPacemaker(Pacemaker, DebianPlugin, UbuntuPlugin):
self.envfile = self.path_join("/etc/default/pacemaker")
self.setup_crm_shell()
self.setup_pcs()
- super(DebianPacemaker, self).setup()
+ super().setup()
def postproc(self):
self.postproc_crm_shell()
@@ -156,7 +161,7 @@ class RedHatPacemaker(Pacemaker, RedHatPlugin):
self.envfile = self.path_join("/etc/sysconfig/pacemaker")
self.setup_pcs()
self.add_copy_spec("/etc/sysconfig/sbd")
- super(RedHatPacemaker, self).setup()
+ super().setup()
def postproc(self):
self.postproc_pcs()
diff --git a/sos/report/plugins/pcp.py b/sos/report/plugins/pcp.py
index 2c6772e2..3a08b546 100644
--- a/sos/report/plugins/pcp.py
+++ b/sos/report/plugins/pcp.py
@@ -8,9 +8,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, PluginOpt
-import os
from socket import gethostname
+from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, PluginOpt
class Pcp(Plugin, RedHatPlugin, DebianPlugin):
@@ -37,17 +36,10 @@ class Pcp(Plugin, RedHatPlugin, DebianPlugin):
pcp_hostname = ''
- def get_size(self, path):
- total_size = 0
- for dirpath, dirnames, filenames in os.walk(path):
- for f in filenames:
- fp = self.path_join(dirpath, f)
- total_size += os.path.getsize(fp)
- return total_size
-
def pcp_parse_conffile(self):
+ """ Parse PCP configuration """
try:
- with open(self.pcp_conffile, "r") as pcpconf:
+ with open(self.pcp_conffile, "r", encoding='UTF-8') as pcpconf:
lines = pcpconf.readlines()
except IOError:
return False
@@ -65,17 +57,17 @@ class Pcp(Plugin, RedHatPlugin, DebianPlugin):
self.pcp_sysconf_dir = env_vars['PCP_SYSCONF_DIR']
self.pcp_var_dir = env_vars['PCP_VAR_DIR']
self.pcp_log_dir = env_vars['PCP_LOG_DIR']
- except Exception:
+ except Exception: # pylint: disable=broad-except
# Fail if all three env variables are not found
return False
return True
def setup(self):
- self.sizelimit = (None if self.get_option("all_logs")
- else self.get_option("pmmgrlogs"))
- self.countlimit = (None if self.get_option("all_logs")
- else self.get_option("pmloggerfiles"))
+ sizelimit = (None if self.get_option("all_logs")
+ else self.get_option("pmmgrlogs"))
+ countlimit = (None if self.get_option("all_logs")
+ else self.get_option("pmloggerfiles"))
if not self.pcp_parse_conffile():
self._log_warn("could not parse %s" % self.pcp_conffile)
@@ -122,7 +114,7 @@ class Pcp(Plugin, RedHatPlugin, DebianPlugin):
# collect pmmgr logs up to 'pmmgrlogs' size limit
path = self.path_join(self.pcp_log_dir, 'pmmgr',
self.pcp_hostname, '*')
- self.add_copy_spec(path, sizelimit=self.sizelimit, tailit=False)
+ self.add_copy_spec(path, sizelimit=sizelimit, tailit=False)
# collect newest pmlogger logs up to 'pmloggerfiles' count
files_collected = 0
path = self.path_join(self.pcp_log_dir, 'pmlogger',
@@ -132,7 +124,7 @@ class Pcp(Plugin, RedHatPlugin, DebianPlugin):
for line in pmlogger_ls['output'].splitlines():
self.add_copy_spec(line, sizelimit=0)
files_collected = files_collected + 1
- if self.countlimit and files_collected == self.countlimit:
+ if countlimit and files_collected == countlimit:
break
self.add_copy_spec([
diff --git a/sos/report/plugins/peripety.py b/sos/report/plugins/peripety.py
index 501256e1..4c1bf51a 100644
--- a/sos/report/plugins/peripety.py
+++ b/sos/report/plugins/peripety.py
@@ -8,9 +8,9 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin
from re import match
import glob
+from sos.report.plugins import Plugin, RedHatPlugin
class Peripety(Plugin, RedHatPlugin):
diff --git a/sos/report/plugins/pmem.py b/sos/report/plugins/pmem.py
index ef6147df..ed1e7a49 100644
--- a/sos/report/plugins/pmem.py
+++ b/sos/report/plugins/pmem.py
@@ -9,7 +9,7 @@
from sos.report.plugins import Plugin, IndependentPlugin
-class pmem(Plugin, IndependentPlugin):
+class PMem(Plugin, IndependentPlugin):
"""This plugin collects data from Persistent Memory devices,
commonly referred to as NVDIMM's or Storage Class Memory (SCM)
"""
@@ -30,20 +30,19 @@ class pmem(Plugin, IndependentPlugin):
"/var/log/ipmctl"
])
- """ Use the ndctl-list(1) command to collect:
- -i Include idle (not enabled) devices in the listing
- -vvv Increase verbosity of the output
- -B Include bus info in the listing
- -D Include dimm info in the listing
- -F Include dimm firmware info in the listing
- -H Include dimm health info in the listing
- -M Include media errors (badblocks) in the listing
- -N Include namespace info in the listing
- -R Include region info in the listing
- -X Include device-dax info in the listing
-
- Output is JSON formatted
- """
+ # Use the ndctl-list(1) command to collect:
+ # -i Include idle (not enabled) devices in the listing
+ # -vvv Increase verbosity of the output
+ # -B Include bus info in the listing
+ # -D Include dimm info in the listing
+ # -F Include dimm firmware info in the listing
+ # -H Include dimm health info in the listing
+ # -M Include media errors (badblocks) in the listing
+ # -N Include namespace info in the listing
+ # -R Include region info in the listing
+ # -X Include device-dax info in the listing
+ #
+ # Output is JSON formatted
self.add_cmd_output([
"ndctl --version",
"ndctl list -vvv",
@@ -51,21 +50,19 @@ class pmem(Plugin, IndependentPlugin):
"ndctl read-labels -j all"
])
- """ Use the daxctl-list(1) command to collect:
- -i Include idle (not enabled / zero-sized) devices in the listing
- -D Include device-dax instance info in the listing
- -R Include region info in the listing
-
- Output is JSON formatted
- """
+ # Use the daxctl-list(1) command to collect:
+ # -i Include idle (not enabled / zero-sized) devices in the listing
+ # -D Include device-dax instance info in the listing
+ # -R Include region info in the listing
+ #
+ # Output is JSON formatted
self.add_cmd_output([
"daxctl list",
"daxctl list -iDR"
])
- """ Use the ipmctl(1) command to collect data from
- Intel(R) Optane(TM) Persistent Memory Modules.
- """
+ # Use the ipmctl(1) command to collect data from
+ # Intel(R) Optane(TM) Persistent Memory Modules.
self.add_cmd_output([
"ipmctl version",
"ipmctl show -cap",
diff --git a/sos/report/plugins/postfix.py b/sos/report/plugins/postfix.py
index 0cef0cd5..df6c85b3 100644
--- a/sos/report/plugins/postfix.py
+++ b/sos/report/plugins/postfix.py
@@ -6,9 +6,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-
import re
+from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Postfix(Plugin):
@@ -20,8 +19,9 @@ class Postfix(Plugin):
packages = ('postfix',)
def forbidden_ssl_keys_files(self):
- # list of attributes defining a location of a SSL key file
- # we must forbid from collection
+ """ list of attributes defining a location of a SSL key file
+ we must forbid from collection
+ """
forbid_attributes = [
"lmtp_tls_dkey_file",
"lmtp_tls_eckey_file",
@@ -41,31 +41,35 @@ class Postfix(Plugin):
"tlsproxy_tls_dh1024_param_file",
"tlsproxy_tls_dh512_param_file",
]
- fp = []
+ fpaths = []
try:
- with open(self.path_join('/etc/postfix/main.cf'), 'r') as cffile:
+ with open(self.path_join('/etc/postfix/main.cf'), 'r',
+ encoding='UTF-8') as cffile:
for line in cffile.readlines():
# ignore comments and take the first word after '='
if line.startswith('#'):
continue
words = line.split('=')
if words[0].strip() in forbid_attributes:
- fp.append(words[1].split()[0])
- finally:
- return fp
+ fpaths.append(words[1].split()[0])
+ except Exception: # pylint: disable=broad-except
+ pass
+ return fpaths
def forbidden_password_files(self):
+ """ Get the list of password to exclude """
forbid_attributes = (
"lmtp_sasl_password_maps",
"smtp_sasl_password_maps",
"postscreen_dnsbl_reply_map",
"smtp_sasl_auth_cache_name",
)
- fp = []
+ fpaths = []
prefix = 'hash:'
option_format = re.compile(r"^(.*)=(.*)")
try:
- with open(self.path_join('/etc/postfix/main.cf'), 'r') as cffile:
+ with open(self.path_join('/etc/postfix/main.cf'), 'r',
+ encoding='UTF-8') as cffile:
for line in cffile.readlines():
# ignore comment and check option format
line = re.sub('#.*', '', line)
@@ -83,12 +87,12 @@ class Postfix(Plugin):
# remove prefix
if filepath.startswith(prefix):
filepath = filepath[len(prefix):]
- fp.append(filepath)
- except Exception as e:
+ fpaths.append(filepath)
+ except Exception as err: # pylint: disable=broad-except
# error log
- msg = f"Error parsing main.cf: {e.args[0]}"
+ msg = f"Error parsing main.cf: {err.args[0]}"
self._log_error(msg)
- return fp
+ return fpaths
def setup(self):
self.add_copy_spec([
@@ -114,7 +118,7 @@ class RedHatPostfix(Postfix, RedHatPlugin):
packages = ('postfix',)
def setup(self):
- super(RedHatPostfix, self).setup()
+ super().setup()
self.add_copy_spec("/etc/mail")
@@ -122,7 +126,5 @@ class DebianPostfix(Postfix, DebianPlugin, UbuntuPlugin):
packages = ('postfix',)
- def setup(self):
- super(DebianPostfix, self).setup()
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/postgresql.py b/sos/report/plugins/postgresql.py
index 22bde425..7e576ad0 100644
--- a/sos/report/plugins/postgresql.py
+++ b/sos/report/plugins/postgresql.py
@@ -46,6 +46,7 @@ class PostgreSQL(Plugin):
]
def do_pg_dump(self, filename="pgdump.tar"):
+ """ Extract PostgreSQL database into a tar file """
if self.get_option("dbname"):
if self.get_option("password") or "PGPASSWORD" in os.environ:
# We're only modifying this for ourself and our children so
@@ -86,7 +87,7 @@ class PostgreSQL(Plugin):
class RedHatPostgreSQL(PostgreSQL, RedHatPlugin):
def setup(self):
- super(RedHatPostgreSQL, self).setup()
+ super().setup()
pghome = self.get_option("pghome")
dirs = [pghome]
@@ -101,14 +102,14 @@ class RedHatPostgreSQL(PostgreSQL, RedHatPlugin):
self.add_copy_spec(filename)
# copy PG_VERSION and postmaster.opts
- for f in ["PG_VERSION", "postmaster.opts"]:
- self.add_copy_spec(self.path_join(_dir, "data", f))
+ for file in ["PG_VERSION", "postmaster.opts"]:
+ self.add_copy_spec(self.path_join(_dir, "data", file))
class DebianPostgreSQL(PostgreSQL, DebianPlugin, UbuntuPlugin):
def setup(self):
- super(DebianPostgreSQL, self).setup()
+ super().setup()
self.add_copy_spec([
"/var/log/postgresql/*.log",
diff --git a/sos/report/plugins/powerpc.py b/sos/report/plugins/powerpc.py
index 465738a5..2d919181 100644
--- a/sos/report/plugins/powerpc.py
+++ b/sos/report/plugins/powerpc.py
@@ -22,15 +22,16 @@ class PowerPC(Plugin, IndependentPlugin):
def setup(self):
try:
- with open(self.path_join('/proc/cpuinfo'), 'r') as fp:
- contents = fp.read()
- ispSeries = "pSeries" in contents
- isPowerNV = "PowerNV" in contents
+ with open(self.path_join('/proc/cpuinfo'), 'r',
+ encoding='UTF-8') as file:
+ contents = file.read()
+ isp_series = "pSeries" in contents
+ is_power_nv = "PowerNV" in contents
except IOError:
- ispSeries = False
- isPowerNV = False
+ isp_series = False
+ is_power_nv = False
- if ispSeries or isPowerNV:
+ if isp_series or is_power_nv:
self.add_copy_spec([
"/proc/device-tree/",
"/proc/loadavg",
@@ -64,7 +65,7 @@ class PowerPC(Plugin, IndependentPlugin):
"rmcdomainstatus -s ctrmc -a ip"
])
- if ispSeries:
+ if isp_series:
self.add_copy_spec([
"/proc/ppc64/lparcfg",
"/proc/ppc64/eeh",
@@ -107,7 +108,7 @@ class PowerPC(Plugin, IndependentPlugin):
"ctrmc"
])
- if isPowerNV:
+ if is_power_nv:
self.add_copy_spec([
"/proc/ppc64/eeh",
"/proc/ppc64/systemcfg",
diff --git a/sos/report/plugins/psacct.py b/sos/report/plugins/psacct.py
index 6c89c75a..0b8c4c90 100644
--- a/sos/report/plugins/psacct.py
+++ b/sos/report/plugins/psacct.py
@@ -28,7 +28,7 @@ class RedHatPsacct(Psacct, RedHatPlugin):
packages = ("psacct", )
def setup(self):
- super(RedHatPsacct, self).setup()
+ super().setup()
self.add_copy_spec("/var/account/pacct")
if self.get_option("all"):
self.add_copy_spec("/var/account/pacct*.gz")
@@ -39,7 +39,7 @@ class DebianPsacct(Psacct, DebianPlugin, UbuntuPlugin):
packages = ("acct", )
def setup(self):
- super(DebianPsacct, self).setup()
+ super().setup()
self.add_copy_spec(["/var/log/account/pacct", "/etc/default/acct"])
if self.get_option("all"):
self.add_copy_spec("/var/log/account/pacct*.gz")
diff --git a/sos/report/plugins/pulp.py b/sos/report/plugins/pulp.py
index f5c762f4..d958e58a 100644
--- a/sos/report/plugins/pulp.py
+++ b/sos/report/plugins/pulp.py
@@ -8,9 +8,9 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
-from pipes import quote
from re import match
+from shlex import quote
+from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
class Pulp(Plugin, RedHatPlugin):
@@ -25,6 +25,11 @@ class Pulp(Plugin, RedHatPlugin):
desc='number of tasks to collect from DB queries')
]
+ dbhost = "localhost"
+ dbport = "27017"
+ dbuser = ""
+ dbpassword = ""
+
def setup(self):
# get mongo DB host and port from line like:
@@ -38,15 +43,11 @@ class Pulp(Plugin, RedHatPlugin):
# further, collect location of CA file for contacting qpid in section
# [messaging]
# certfile: /etc/pki/katello/qpid_client_striped.crt
- self.dbhost = "localhost"
- self.dbport = "27017"
- self.dbuser = ""
- self.dbpassword = ""
- self.messaging_cert_file = ""
+ messaging_cert_file = ""
in_messaging_section = False
try:
- with open("/etc/pulp/server.conf", 'r') as pfile:
- pulp_lines = pfile.read().splitlines()
+ with open("/etc/pulp/server.conf", 'r', encoding='UTF-8') as file:
+ pulp_lines = file.read().splitlines()
for line in pulp_lines:
if match(r"^\s*seeds:\s+\S+:\S+", line):
uri = line.split()[1].split(',')[0].split(':')
@@ -59,7 +60,7 @@ class Pulp(Plugin, RedHatPlugin):
if line.startswith("[messaging]"):
in_messaging_section = True
if in_messaging_section and line.startswith("certfile:"):
- self.messaging_cert_file = line.split()[1]
+ messaging_cert_file = line.split()[1]
in_messaging_section = False
except IOError:
# fallback when the cfg file is not accessible
@@ -137,7 +138,7 @@ class Pulp(Plugin, RedHatPlugin):
for opt in "quc":
self.add_cmd_output(
f"qpid-stat -{opt} --ssl-certificate="
- f"{self.messaging_cert_file} -b amqps://localhost:5671",
+ f"{messaging_cert_file} -b amqps://localhost:5671",
tags=f"qpid_stat_{opt}")
self.add_cmd_output(
@@ -147,6 +148,7 @@ class Pulp(Plugin, RedHatPlugin):
)
def build_mongo_cmd(self, query):
+ """ Build mongoDB command """
_cmd = "bash -c %s"
_mondb = "--host %s --port %s %s %s" % (self.dbhost, self.dbport,
self.dbuser, self.dbpassword)
diff --git a/sos/report/plugins/pulpcore.py b/sos/report/plugins/pulpcore.py
index 649626ad..07b69546 100644
--- a/sos/report/plugins/pulpcore.py
+++ b/sos/report/plugins/pulpcore.py
@@ -8,9 +8,9 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt
-from pipes import quote
from re import match
+from shlex import quote
+from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt
class PulpCore(Plugin, IndependentPlugin):
@@ -24,16 +24,17 @@ class PulpCore(Plugin, IndependentPlugin):
PluginOpt('task-days', default=7, desc='days of task history')
]
+ dbhost = "localhost"
+ dbport = 5432
+ dbname = "pulpcore"
+ dbpasswd = ""
+ staticroot = "/var/lib/pulp/assets"
+ uploaddir = "/var/lib/pulp/media/upload"
+ env = {"PGPASSWORD": dbpasswd}
+
def parse_settings_config(self):
+ """ Parse pulp settings """
databases_scope = False
- self.dbhost = "localhost"
- self.dbport = 5432
- self.dbname = "pulpcore"
- self.dbpasswd = ""
- # TODO: read also redis config (we dont expect much customisations)
- # TODO: read also db user (pulp)
- self.staticroot = "/var/lib/pulp/assets"
- self.uploaddir = "/var/lib/pulp/media/upload"
def separate_value(line, sep=':'):
# an auxiliary method to parse values from lines like:
@@ -45,9 +46,9 @@ class PulpCore(Plugin, IndependentPlugin):
return val
try:
- with open("/etc/pulp/settings.py", 'r') as pfile:
+ with open("/etc/pulp/settings.py", 'r', encoding='UTF-8') as file:
# split the lines to "one option per line" format
- for line in pfile.read() \
+ for line in file.read() \
.replace(',', ',\n').replace('{', '{\n') \
.replace('}', '\n}').splitlines():
# skip empty lines and lines with comments
diff --git a/sos/report/plugins/puppet.py b/sos/report/plugins/puppet.py
index ee6f7724..01763598 100644
--- a/sos/report/plugins/puppet.py
+++ b/sos/report/plugins/puppet.py
@@ -6,8 +6,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, IndependentPlugin
from glob import glob
+from sos.report.plugins import Plugin, IndependentPlugin
class Puppet(Plugin, IndependentPlugin):
@@ -59,5 +59,4 @@ class Puppet(Plugin, IndependentPlugin):
r"\1%s\2" % ('***')
)
- return
# vim: et ts=4 sw=4
diff --git a/sos/report/plugins/pxe.py b/sos/report/plugins/pxe.py
index cd6ef366..3468d1df 100644
--- a/sos/report/plugins/pxe.py
+++ b/sos/report/plugins/pxe.py
@@ -27,7 +27,7 @@ class RedHatPxe(Pxe, RedHatPlugin):
packages = ('system-config-netboot-cmd',)
def setup(self):
- super(RedHatPxe, self).setup()
+ super().setup()
self.add_cmd_output("/usr/sbin/pxeos -l")
self.add_copy_spec("/etc/dhcpd.conf")
if self.get_option("tftpboot"):
@@ -39,7 +39,7 @@ class DebianPxe(Pxe, DebianPlugin, UbuntuPlugin):
packages = ('tftpd-hpa',)
def setup(self):
- super(DebianPxe, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/dhcp/dhcpd.conf",
"/etc/default/tftpd-hpa"
diff --git a/sos/report/plugins/python.py b/sos/report/plugins/python.py
index 4c8b9e0f..0d151247 100644
--- a/sos/report/plugins/python.py
+++ b/sos/report/plugins/python.py
@@ -8,12 +8,12 @@
#
# See the LICENSE file in the source distribution for further information.
+import hashlib
+import json
+import os
from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin,
UbuntuPlugin, PluginOpt)
from sos.policies.distros.redhat import RHELPolicy
-import os
-import json
-import hashlib
class Python(Plugin):
@@ -67,7 +67,7 @@ class RedHatPython(Python, RedHatPlugin):
if isinstance(self.policy, RHELPolicy) and \
self.policy.dist_version() == 8:
self.python_version = "/usr/libexec/platform-python -V"
- super(RedHatPython, self).setup()
+ super().setup()
def collect(self):
if self.get_option('hashes'):
@@ -75,6 +75,7 @@ class RedHatPython(Python, RedHatPlugin):
hfile.write(json.dumps(self.get_hashes(), indent=4))
def get_hashes(self):
+ """ Get the hashes for Python files """
digests = {
'digests': []
}
@@ -92,12 +93,12 @@ class RedHatPython(Python, RedHatPlugin):
continue
filepath = self.path_join(root, _file)
try:
- with open(filepath, 'rb') as f:
+ with open(filepath, 'rb') as file:
digest = hashlib.sha256()
- data = f.read(1024)
+ data = file.read(1024)
while data:
digest.update(data)
- data = f.read(1024)
+ data = file.read(1024)
digest = digest.hexdigest()
digests['digests'].append({
diff --git a/sos/report/plugins/qpid_dispatch.py b/sos/report/plugins/qpid_dispatch.py
index 12f25988..f6f11f27 100644
--- a/sos/report/plugins/qpid_dispatch.py
+++ b/sos/report/plugins/qpid_dispatch.py
@@ -8,8 +8,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
from socket import gethostname
+from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
class QpidDispatch(Plugin, RedHatPlugin):
diff --git a/sos/report/plugins/radius.py b/sos/report/plugins/radius.py
index 89b951b4..59d76fb5 100644
--- a/sos/report/plugins/radius.py
+++ b/sos/report/plugins/radius.py
@@ -25,7 +25,7 @@ class RedHatRadius(Radius, RedHatPlugin):
files = ('/etc/raddb',)
def setup(self):
- super(RedHatRadius, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/raddb",
"/etc/pam.d/radiusd",
@@ -42,7 +42,7 @@ class DebianRadius(Radius, DebianPlugin, UbuntuPlugin):
files = ('/etc/freeradius',)
def setup(self):
- super(DebianRadius, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/freeradius",
"/etc/pam.d/radiusd",
diff --git a/sos/report/plugins/release.py b/sos/report/plugins/release.py
index 7086ba77..8c8a91a6 100644
--- a/sos/report/plugins/release.py
+++ b/sos/report/plugins/release.py
@@ -31,7 +31,7 @@ class Release(Plugin, UbuntuPlugin, CosPlugin):
class DebianRelease(Release, DebianPlugin):
def setup(self):
- super(DebianRelease, self).setup()
+ super().setup()
self.add_copy_spec('/etc/debian_version')
@@ -39,6 +39,6 @@ class RedHatRelease(Release, RedHatPlugin):
def setup(self):
self.add_file_tags({'/etc/redhat-release': 'redhat_release'})
- super(RedHatRelease, self).setup()
+ super().setup()
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/rhv_analyzer.py b/sos/report/plugins/rhv_analyzer.py
index fd36da8e..635079a3 100644
--- a/sos/report/plugins/rhv_analyzer.py
+++ b/sos/report/plugins/rhv_analyzer.py
@@ -11,7 +11,7 @@
from sos.report.plugins import Plugin, RedHatPlugin
-class Rhv_Analyzer(Plugin, RedHatPlugin):
+class RhvAnalyzer(Plugin, RedHatPlugin):
short_desc = 'RHV Log Collector Analyzer'
diff --git a/sos/report/plugins/s390.py b/sos/report/plugins/s390.py
index 1d1d15e5..4f39af38 100644
--- a/sos/report/plugins/s390.py
+++ b/sos/report/plugins/s390.py
@@ -68,12 +68,12 @@ class S390(Plugin, IndependentPlugin):
"smc_dbg"
])
- r = self.exec_cmd("ls /dev/dasd?")
- dasd_dev = r['output']
- for x in dasd_dev.split('\n'):
+ ret = self.exec_cmd("ls /dev/dasd?")
+ dasd_dev = ret['output']
+ for dev in dasd_dev.split('\n'):
self.add_cmd_output([
- "dasdview -x -i -j -l -f %s" % (x,),
- "fdasd -p %s" % (x,)
+ "dasdview -x -i -j -l -f %s" % (dev,),
+ "fdasd -p %s" % (dev,)
])
diff --git a/sos/report/plugins/saltmaster.py b/sos/report/plugins/saltmaster.py
index e836d96f..48fe52c6 100644
--- a/sos/report/plugins/saltmaster.py
+++ b/sos/report/plugins/saltmaster.py
@@ -42,6 +42,7 @@ class SaltMaster(Plugin, IndependentPlugin):
], timeout=30)
def add_pillar_roots(self):
+ """ Collect pilliar_roots of all salt configs """
cfgs = glob.glob("/etc/salt/master.d/*conf")
main_cfg = "/etc/salt/master"
@@ -50,9 +51,10 @@ class SaltMaster(Plugin, IndependentPlugin):
all_pillar_roots = []
for cfg in cfgs:
- with open(cfg, "r") as f:
+ with open(cfg, "r", encoding='UTF-8') as file:
cfg_pillar_roots = (
- yaml.safe_load(f).get("pillar_roots", {}).get("base", [])
+ yaml.safe_load(file).get("pillar_roots", {}).
+ get("base", [])
)
all_pillar_roots.extend(cfg_pillar_roots)
diff --git a/sos/report/plugins/samba.py b/sos/report/plugins/samba.py
index c1bef275..73796500 100644
--- a/sos/report/plugins/samba.py
+++ b/sos/report/plugins/samba.py
@@ -48,7 +48,7 @@ class Samba(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
class RedHatSamba(Samba, RedHatPlugin):
def setup(self):
- super(RedHatSamba, self).setup()
+ super().setup()
self.add_copy_spec("/etc/sysconfig/samba")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/sanlock.py b/sos/report/plugins/sanlock.py
index d1e35940..e72a41e1 100644
--- a/sos/report/plugins/sanlock.py
+++ b/sos/report/plugins/sanlock.py
@@ -23,7 +23,6 @@ class SANLock(Plugin):
"sanlock client host_status -D",
"sanlock client log_dump"
])
- return
class RedHatSANLock(SANLock, RedHatPlugin):
@@ -31,7 +30,7 @@ class RedHatSANLock(SANLock, RedHatPlugin):
files = ("/etc/sysconfig/sanlock",)
def setup(self):
- super(RedHatSANLock, self).setup()
+ super().setup()
self.add_copy_spec("/etc/sysconfig/sanlock")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/saphana.py b/sos/report/plugins/saphana.py
index 41772eb1..8e1e8b62 100644
--- a/sos/report/plugins/saphana.py
+++ b/sos/report/plugins/saphana.py
@@ -9,7 +9,7 @@
from sos.report.plugins import Plugin, RedHatPlugin
-class saphana(Plugin, RedHatPlugin):
+class Saphana(Plugin, RedHatPlugin):
short_desc = 'SAP HANA'
plugin_name = 'saphana'
@@ -21,8 +21,8 @@ class saphana(Plugin, RedHatPlugin):
sids = []
if self.path_isdir("/hana/shared"):
- s = self.listdir("/hana/shared")
- for sid in s:
+ shared = self.listdir("/hana/shared")
+ for sid in shared:
if len(sid) == 3:
sid = sid.strip()
sids.append(sid)
@@ -51,6 +51,7 @@ class saphana(Plugin, RedHatPlugin):
self.get_inst_info(sid, sidadm, inst)
def get_inst_info(self, sid, sidadm, inst):
+ """ Collect the given instance info """
proc_cmd = 'su - %s -c "sapcontrol -nr %s -function GetProcessList"'
status_fname = "%s_%s_status" % (sid, inst)
self.add_cmd_output(
diff --git a/sos/report/plugins/sapnw.py b/sos/report/plugins/sapnw.py
index 7424411d..23af0a8f 100644
--- a/sos/report/plugins/sapnw.py
+++ b/sos/report/plugins/sapnw.py
@@ -9,7 +9,7 @@
from sos.report.plugins import Plugin, RedHatPlugin
-class sapnw(Plugin, RedHatPlugin):
+class Sapnw(Plugin, RedHatPlugin):
short_desc = 'SAP NetWeaver'
plugin_name = 'sapnw'
@@ -17,24 +17,18 @@ class sapnw(Plugin, RedHatPlugin):
files = ('/usr/sap',)
def collect_list_instances(self):
- # list installed instances
- inst_out = self.collect_cmd_output(
+ """ Collect data on installed instances """
+ inst_list = self.collect_cmd_output(
"/usr/sap/hostctrl/exe/saphostctrl -function ListInstances",
suggest_filename="SAPInstances"
)
- if inst_out['status'] != 0:
+ if inst_list['status'] != 0:
return
- # set the common strings that will be formatted later in each a_c_s
- prof_cmd = "env -i %s %s/sappfpar all pf=/usr/sap/%s/SYS/profile/%s"
- inst_cmd = "env -i %s %s/sapcontrol -nr %s -function GetProcessList"
- vers_cmd = "env -i %s %s/sapcontrol -nr %s -function GetVersionInfo"
- user_cmd = 'su - %sadm -c "sapcontrol -nr %s -function GetEnvironment"'
-
sidsunique = set()
# Cycle through all the instances, get 'sid', 'instance_number'
# and 'vhost' to determine the proper profile
- for inst_line in inst_out['output'].splitlines():
+ for inst_line in inst_list['output'].splitlines():
if ("DAA" not in inst_line and not
inst_line.startswith("No instances found")):
fields = inst_line.strip().split()
@@ -50,26 +44,32 @@ class sapnw(Plugin, RedHatPlugin):
for line in self.listdir(path):
if all(f in line for f in [sid, inst, vhost]):
ldenv = 'LD_LIBRARY_PATH=/usr/sap/%s/SYS/exe/run' % sid
- # TODO: I am assuming unicode here
+ # Unicode is assumed here
# nuc should be accounted
- pt = '/usr/sap/%s/SYS/exe/uc/linuxx86_64' % sid
+ path = '/usr/sap/%s/SYS/exe/uc/linuxx86_64' % sid
profile = line.strip()
# collect profiles
self.add_cmd_output(
- prof_cmd % (ldenv, pt, sid, profile),
+ "env -i %s %s/sappfpar all "
+ "pf=/usr/sap/%s/SYS/profile/%s" %
+ (ldenv, path, sid, profile),
suggest_filename="%s_parameters" % profile
)
# collect instance status
self.add_cmd_output(
- inst_cmd % (ldenv, pt, inst),
+ "env -i %s %s/sapcontrol -nr %s "
+ "-function GetProcessList"
+ % (ldenv, path, inst),
suggest_filename="%s_%s_GetProcList" % (sid, inst)
)
# collect version info for the various components
self.add_cmd_output(
- vers_cmd % (ldenv, pt, inst),
+ "env -i %s %s/sapcontrol -nr %s "
+ "-function GetVersionInfo"
+ % (ldenv, path, inst),
suggest_filename="%s_%s_GetVersInfo" % (sid, inst)
)
@@ -77,7 +77,9 @@ class sapnw(Plugin, RedHatPlugin):
lowsid = sid.lower()
fname = "%s_%sadm_%s_userenv" % (sid, lowsid, inst)
self.add_cmd_output(
- user_cmd % (lowsid, inst),
+ 'su - %sadm -c "sapcontrol -nr %s '
+ '-function GetEnvironment"'
+ % (lowsid, inst),
suggest_filename=fname
)
@@ -86,16 +88,17 @@ class sapnw(Plugin, RedHatPlugin):
self.add_copy_spec("/usr/sap/%s/*DVEB*/work/dev_w0" % sid)
def collect_list_dbs(self):
+ """ Collect data all the installed DBs """
# list installed sap dbs
- db_out = self.collect_cmd_output(
+ db_list = self.collect_cmd_output(
"/usr/sap/hostctrl/exe/saphostctrl -function ListDatabases",
suggest_filename="SAPDatabases"
)
- if db_out['status'] != 0:
+ if db_list['status'] != 0:
return
- for line in db_out['output'].splitlines():
+ for line in db_list['output'].splitlines():
if "Instance name" in line:
fields = line.strip().split()
dbadm = fields[2][:-1]
diff --git a/sos/report/plugins/sar.py b/sos/report/plugins/sar.py
index 64bb0d0d..fdf2a3c6 100644
--- a/sos/report/plugins/sar.py
+++ b/sos/report/plugins/sar.py
@@ -6,11 +6,11 @@
#
# See the LICENSE file in the source distribution for further information.
+from datetime import datetime as dt
+import os
+import re
from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin,
UbuntuPlugin, PluginOpt)
-import re
-import os
-from datetime import datetime as dt
class Sar(Plugin):
@@ -72,24 +72,27 @@ class Sar(Plugin):
sar_filename = 'sar' + fname[2:]
if sar_filename not in dir_list:
# only collect sar output for the last 7 days by default
- if not self.get_option('all_sar'):
- try:
- _ftime = os.stat(sa_data_path).st_mtime
- _age = dt.today() - dt.fromtimestamp(_ftime)
- if _age.days > 7:
- continue
- except Exception as err:
- self._log_warn(
- "Could not determine age of '%s' - skipping "
- "converting to sar format: %s"
- % (sa_data_path, err)
- )
- continue
+ if not self.get_option('all_sar') and \
+ self.is_older_than_7days(sa_data_path):
+ continue
sar_cmd = "sar -A -f %s" % sa_data_path
self.add_cmd_output(sar_cmd, sar_filename)
sadf_cmd = "sadf -x -- -A %s" % sa_data_path
self.add_cmd_output(sadf_cmd, "%s.xml" % fname)
+ def is_older_than_7days(self, sarfile):
+ """ Is the file older than 7 days? """
+ try:
+ _ftime = os.stat(sarfile).st_mtime
+ _age = dt.today() - dt.fromtimestamp(_ftime)
+ if _age.days <= 7:
+ return False
+ except Exception as err: # pylint: disable=broad-except
+ self._log_warn("Could not determine age of '%s' - skipping "
+ "converting to sar format: %s" % (sarfile, err))
+
+ return True
+
class RedHatSar(Sar, RedHatPlugin):
diff --git a/sos/report/plugins/sas3ircu.py b/sos/report/plugins/sas3ircu.py
index 96bf711a..bacb215a 100644
--- a/sos/report/plugins/sas3ircu.py
+++ b/sos/report/plugins/sas3ircu.py
@@ -25,7 +25,7 @@ class SAS3ircu(Plugin, IndependentPlugin):
# get list of adapters
result = self.collect_cmd_output("sas3ircu list", timeout=5)
- if (result["status"] == 0):
+ if result["status"] == 0:
# only want devices
sas_lst = result["output"].splitlines()[10:-1]
diff --git a/sos/report/plugins/scsi.py b/sos/report/plugins/scsi.py
index 1589c20a..2d75217f 100644
--- a/sos/report/plugins/scsi.py
+++ b/sos/report/plugins/scsi.py
@@ -43,7 +43,7 @@ class Scsi(Plugin, IndependentPlugin):
result = self.collect_cmd_output('lsscsi -g')
if result['status'] == 0:
for line in result['output'].splitlines():
- if (line.split()[1] in scsi_types):
+ if line.split()[1] in scsi_types:
devsg = line.split()[-1]
self.add_cmd_output("sg_ses -p2 -b1 %s" % devsg)
diff --git a/sos/report/plugins/sedutil.py b/sos/report/plugins/sedutil.py
index f46fab0c..c8168c8e 100644
--- a/sos/report/plugins/sedutil.py
+++ b/sos/report/plugins/sedutil.py
@@ -42,6 +42,7 @@ class SEDUtility(Plugin, IndependentPlugin):
self.do_debug(sed_list)
def do_debug(self, sed_list):
+ """ Collect debug logs """
for device in sed_list:
self.add_cmd_output(f"sedutil-cli --query {device}")
diff --git a/sos/report/plugins/sendmail.py b/sos/report/plugins/sendmail.py
index 923dad7b..528a308c 100644
--- a/sos/report/plugins/sendmail.py
+++ b/sos/report/plugins/sendmail.py
@@ -32,7 +32,7 @@ class RedHatSendmail(Sendmail, RedHatPlugin):
files = ('/etc/rc.d/init.d/sendmail',)
def setup(self):
- super(RedHatSendmail, self).setup()
+ super().setup()
self.add_copy_spec('/var/log/maillog')
@@ -41,7 +41,7 @@ class DebianSendmail(Sendmail, DebianPlugin, UbuntuPlugin):
files = ('/etc/init.d/sendmail',)
def setup(self):
- super(DebianSendmail, self).setup()
+ super().setup()
self.add_copy_spec("/var/log/mail.*")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/services.py b/sos/report/plugins/services.py
index 6b93d57f..59b45f24 100644
--- a/sos/report/plugins/services.py
+++ b/sos/report/plugins/services.py
@@ -39,7 +39,7 @@ class Services(Plugin):
class RedHatServices(Services, RedHatPlugin):
def setup(self):
- super(RedHatServices, self).setup()
+ super().setup()
self.add_cmd_output("chkconfig --list", root_symlink="chkconfig",
tags="chkconfig")
@@ -47,7 +47,7 @@ class RedHatServices(Services, RedHatPlugin):
class DebianServices(Services, DebianPlugin, UbuntuPlugin):
def setup(self):
- super(DebianServices, self).setup()
+ super().setup()
self.add_copy_spec("/etc/rc*.d")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/shmcli.py b/sos/report/plugins/shmcli.py
index aa07c6f3..ad8743b4 100644
--- a/sos/report/plugins/shmcli.py
+++ b/sos/report/plugins/shmcli.py
@@ -30,7 +30,6 @@ class SHMcli(Plugin, IndependentPlugin):
]
def setup(self):
- cmd = self.shmcli_bin
subcmds = [
'list adapters',
@@ -40,9 +39,14 @@ class SHMcli(Plugin, IndependentPlugin):
for subcmd in subcmds:
self.add_cmd_output(
- "%s %s" % (cmd, subcmd),
+ "%s %s" % (self.shmcli_bin, subcmd),
suggest_filename="shmcli_%s" % (subcmd))
+ self.collect_enclosures_list()
+ self.collect_drivers_list()
+
+ def collect_enclosures_list(self):
+ """ Collect info on the enclosures """
models = []
# Get the storage hardware models
@@ -68,43 +72,46 @@ class SHMcli(Plugin, IndependentPlugin):
]
result = self.collect_cmd_output(
- '%s list enclosures' % (cmd),
+ '%s list enclosures' % (self.shmcli_bin),
suggest_filename='shmcli_list_enclosures'
)
if result['status'] == 0:
for line in result['output'].splitlines()[2:-2]:
- _line = line.split()
- if any(m in _line for m in models):
- adapt_index = _line[-1]
- enc_index = _line[0]
+ line = line.split()
+ if any(m in line for m in models):
+ adapt_index = line[-1]
+ enc_index = line[0]
for subcmd in subcmds:
_cmd = ("%s %s -a=%s -enc=%s"
- % (cmd, subcmd, adapt_index, enc_index))
- _fname = _cmd.replace(cmd, 'shmcli')
+ % (self.shmcli_bin, subcmd,
+ adapt_index, enc_index))
+ _fname = _cmd.replace(self.shmcli_bin, 'shmcli')
self.add_cmd_output(_cmd, suggest_filename=_fname)
if self.get_option('debug'):
logpath = self.get_cmd_output_path(make=False)
_dcmd = ("%s getdebugcli -a=%s -enc=%s"
- % (cmd, adapt_index, enc_index))
- _dname = _dcmd.replace(cmd, 'shmcli')
+ % (self.shmcli_bin, adapt_index, enc_index))
+ _dname = _dcmd.replace(self.shmcli_bin, 'shmcli')
_odir = (" -outputdir=%s" % (logpath))
self.add_cmd_output(
_dcmd + _odir, suggest_filename=_dname,
timeout=300
)
+ def collect_drivers_list(self):
+ """ Collect info on the drives """
result = self.collect_cmd_output(
- '%s list drives' % (cmd),
+ '%s list drives' % (self.shmcli_bin),
suggest_filename='shmcli_list_drives'
)
if result['status'] == 0:
for line in result['output'].splitlines():
words = line.split()
- if (len(words) > 6):
+ if len(words) > 6:
if (words[0] not in ['WWN', '---']):
_cmd = ("%s info drive -d=%s"
- % (cmd, words[0]))
- _fname = _cmd.replace(cmd, 'shmcli')
+ % (self.shmcli_bin, words[0]))
+ _fname = _cmd.replace(self.shmcli_bin, 'shmcli')
self.add_cmd_output(_cmd, suggest_filename=_fname)
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/skydive.py b/sos/report/plugins/skydive.py
index 829602aa..3bc0c7eb 100644
--- a/sos/report/plugins/skydive.py
+++ b/sos/report/plugins/skydive.py
@@ -8,8 +8,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
import os
+from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
class Skydive(Plugin, RedHatPlugin):
diff --git a/sos/report/plugins/slurm.py b/sos/report/plugins/slurm.py
index e503c984..1a6437ea 100644
--- a/sos/report/plugins/slurm.py
+++ b/sos/report/plugins/slurm.py
@@ -88,8 +88,8 @@ class Slurm(Plugin, UbuntuPlugin, RedHatPlugin):
slurmctld_log_file = '/var/log/slurmctld.log'
try:
- with open(config_file, 'r') as cf:
- for line in cf.read().splitlines():
+ with open(config_file, 'r', encoding='UTF-8') as cfile:
+ for line in cfile.read().splitlines():
if not line:
continue
words = line.split('=')
diff --git a/sos/report/plugins/smclient.py b/sos/report/plugins/smclient.py
index 88a6cfef..bf94ac18 100644
--- a/sos/report/plugins/smclient.py
+++ b/sos/report/plugins/smclient.py
@@ -49,6 +49,7 @@ class SMcli(Plugin, IndependentPlugin):
self.do_debug(ssnames)
def do_debug(self, ssnames):
+ """ Collect debug logs """
logpath = self.get_cmd_output_path(make=False)
cmd = 'SMcli localhost -n'
diff --git a/sos/report/plugins/snap.py b/sos/report/plugins/snap.py
index 0273772b..009b0c07 100644
--- a/sos/report/plugins/snap.py
+++ b/sos/report/plugins/snap.py
@@ -7,9 +7,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, IndependentPlugin
-
import re
+from sos.report.plugins import Plugin, IndependentPlugin
class Snap(Plugin, IndependentPlugin):
@@ -74,7 +73,7 @@ class Snap(Plugin, IndependentPlugin):
continue
change = line.split()
change_id, change_status = change[0], change[1]
- if change_status == "Doing" or change_status == "Error":
+ if change_status in ("Doing", "Error"):
self.add_cmd_output(f"snap tasks {change_id} --abs-time")
def postproc(self):
diff --git a/sos/report/plugins/snmp.py b/sos/report/plugins/snmp.py
index a74b4104..56977944 100644
--- a/sos/report/plugins/snmp.py
+++ b/sos/report/plugins/snmp.py
@@ -27,15 +27,10 @@ class RedHatSnmp(Snmp, RedHatPlugin):
packages = ('net-snmp',)
- def setup(self):
- super(RedHatSnmp, self).setup()
-
class DebianSnmp(Snmp, DebianPlugin, UbuntuPlugin):
packages = ('snmp',)
- def setup(self):
- super(DebianSnmp, self).setup()
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/sos_extras.py b/sos/report/plugins/sos_extras.py
index 71cc8787..02481c69 100644
--- a/sos/report/plugins/sos_extras.py
+++ b/sos/report/plugins/sos_extras.py
@@ -6,9 +6,9 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, IndependentPlugin
import os
import stat
+from sos.report.plugins import Plugin, IndependentPlugin
class SosExtras(Plugin, IndependentPlugin):
@@ -45,9 +45,9 @@ class SosExtras(Plugin, IndependentPlugin):
def setup(self):
try:
- st = os.stat(self.extras_dir)
- if (st.st_uid != 0) or (st.st_mode & stat.S_IWGRP) or \
- (st.st_mode & stat.S_IWOTH):
+ st_res = os.stat(self.extras_dir)
+ if (st_res.st_uid != 0) or (st_res.st_mode & stat.S_IWGRP) or \
+ (st_res.st_mode & stat.S_IWOTH):
self._log_warn("Skipping sos extras as %s has too wide"
" permissions or ownership." % self.extras_dir)
return
@@ -56,12 +56,12 @@ class SosExtras(Plugin, IndependentPlugin):
self.extras_dir)
return
- for path, dirlist, filelist in os.walk(self.extras_dir):
- for f in filelist:
- _file = self.path_join(path, f)
+ for path, _, filelist in os.walk(self.extras_dir):
+ for file in filelist:
+ _file = self.path_join(path, file)
self._log_warn("Collecting data from extras file %s" % _file)
try:
- with open(_file, 'r') as sfile:
+ with open(_file, 'r', encoding='UTF-8') as sfile:
for line in sfile.read().splitlines():
# ignore empty lines or comments
if len(line.split()) == 0 or line.startswith('#'):
@@ -83,7 +83,7 @@ class SosExtras(Plugin, IndependentPlugin):
sizelimit=limit)
else:
# command to execute
- self.add_cmd_output(line, subdir=f)
+ self.add_cmd_output(line, subdir=file)
except IOError:
self._log_warn("unable to read extras file %s" % _file)
diff --git a/sos/report/plugins/soundcard.py b/sos/report/plugins/soundcard.py
index ce19691e..cc314865 100644
--- a/sos/report/plugins/soundcard.py
+++ b/sos/report/plugins/soundcard.py
@@ -28,8 +28,7 @@ class Soundcard(Plugin):
class RedHatSoundcard(Soundcard, RedHatPlugin):
def setup(self):
- super(RedHatSoundcard, self).setup()
-
+ super().setup()
self.add_copy_spec([
"/etc/alsa/*",
"/etc/asound.*"
@@ -39,8 +38,7 @@ class RedHatSoundcard(Soundcard, RedHatPlugin):
class DebianSoundcard(Soundcard, DebianPlugin, UbuntuPlugin):
def setup(self):
- super(DebianSoundcard, self).setup()
-
+ super().setup()
self.add_copy_spec("/etc/pulse/*")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/ssh.py b/sos/report/plugins/ssh.py
index 05f345b5..c44e813d 100644
--- a/sos/report/plugins/ssh.py
+++ b/sos/report/plugins/ssh.py
@@ -46,11 +46,13 @@ class Ssh(Plugin, IndependentPlugin):
self.user_ssh_files_permissions()
def included_configs(self, sshcfgs):
+ """ Include subconfig files """
# Read configs for any includes and copy those
try:
for sshcfg in sshcfgs:
tag = sshcfg.split('/')[-1]
- with open(self.path_join(sshcfg), 'r') as cfgfile:
+ with open(self.path_join(sshcfg), 'r',
+ encoding='UTF-8') as cfgfile:
for line in cfgfile:
# skip empty lines and comments
if len(line.split()) == 0 or line.startswith('#'):
@@ -59,7 +61,7 @@ class Ssh(Plugin, IndependentPlugin):
if line.lower().startswith('include'):
confarg = line.split()
self.add_copy_spec(confarg[1], tags=tag)
- except Exception:
+ except Exception: # pylint: disable=broad-except
pass
def user_ssh_files_permissions(self):
@@ -73,9 +75,10 @@ class Ssh(Plugin, IndependentPlugin):
if users_data['status']:
# If getent fails, fallback to just reading /etc/passwd
try:
- with open(self.path_join('/etc/passwd')) as passwd_file:
+ with open(self.path_join('/etc/passwd'), 'r',
+ encoding='UTF-8') as passwd_file:
users_data_lines = passwd_file.readlines()
- except Exception:
+ except Exception: # pylint: disable=broad-except
# If we can't read /etc/passwd, then there's something wrong.
self._log_error("Couldn't read /etc/passwd")
return
diff --git a/sos/report/plugins/sssd.py b/sos/report/plugins/sssd.py
index b514ec1b..0255760a 100644
--- a/sos/report/plugins/sssd.py
+++ b/sos/report/plugins/sssd.py
@@ -8,9 +8,9 @@
#
# See the LICENSE file in the source distribution for further information.
+from glob import glob
from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin,
UbuntuPlugin, SoSPredicate)
-from glob import glob
class Sssd(Plugin):
@@ -61,15 +61,13 @@ class Sssd(Plugin):
class RedHatSssd(Sssd, RedHatPlugin):
-
- def setup(self):
- super(RedHatSssd, self).setup()
+ pass
class DebianSssd(Sssd, DebianPlugin, UbuntuPlugin):
def setup(self):
- super(DebianSssd, self).setup()
+ super().setup()
self.add_copy_spec("/etc/default/sssd")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/subscription_manager.py b/sos/report/plugins/subscription_manager.py
index 721cd2a2..a2e4485a 100644
--- a/sos/report/plugins/subscription_manager.py
+++ b/sos/report/plugins/subscription_manager.py
@@ -6,9 +6,9 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin
-import glob
from configparser import NoOptionError, NoSectionError
+import glob
+from sos.report.plugins import Plugin, RedHatPlugin
class SubscriptionManager(Plugin, RedHatPlugin):
@@ -22,7 +22,7 @@ class SubscriptionManager(Plugin, RedHatPlugin):
packages = ('subscription-manager',)
def get_proxy_string(self, config):
- # return curl options --proxy[-user] per RHSM config
+ """ return curl options --proxy[-user] per RHSM config """
proxy = ""
proxy_hostname = config.get('server', 'proxy_hostname')
if proxy_hostname:
@@ -41,7 +41,7 @@ class SubscriptionManager(Plugin, RedHatPlugin):
return proxy
def get_server_url(self, config):
- # return URL per RHSM config for curl command
+ """ return URL per RHSM config for curl command """
secure = "s" if config.get('server', 'insecure') != '1' else ""
port = config.get('server', 'port')
# if port is set, prepend it by ':' separating it from hostname
@@ -85,7 +85,7 @@ class SubscriptionManager(Plugin, RedHatPlugin):
"https://subscription.rhsm.redhat.com:443/subscription"
env = None # for no_proxy
try:
- from rhsm.config import get_config_parser
+ from rhsm.config import get_config_parser # pylint: disable=C0415
config = get_config_parser()
proxy = self.get_proxy_string(config)
server_url = self.get_server_url(config)
diff --git a/sos/report/plugins/system.py b/sos/report/plugins/system.py
index 13a8acc1..9e58dccf 100644
--- a/sos/report/plugins/system.py
+++ b/sos/report/plugins/system.py
@@ -25,7 +25,6 @@ class System(Plugin, IndependentPlugin):
"/etc/environment",
])
- # FIXME: provide a a long-term solution for #1299
self.add_forbidden_path([
"/proc/sys/net/ipv4/route/flush",
"/proc/sys/net/ipv6/route/flush",
diff --git a/sos/report/plugins/tomcat.py b/sos/report/plugins/tomcat.py
index 72ed893c..82f148f0 100644
--- a/sos/report/plugins/tomcat.py
+++ b/sos/report/plugins/tomcat.py
@@ -6,8 +6,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin
from datetime import datetime
+from sos.report.plugins import Plugin, RedHatPlugin
class Tomcat(Plugin, RedHatPlugin):
@@ -45,11 +45,11 @@ class Tomcat(Plugin, RedHatPlugin):
})
def postproc(self):
- serverXmlPasswordAttributes = ['keyPass', 'keystorePass',
- 'truststorePass', 'SSLPassword']
+ server_password_attr = ['keyPass', 'keystorePass',
+ 'truststorePass', 'SSLPassword']
self.do_path_regex_sub(
r"\/etc\/tomcat.*\/server.xml",
- r"(%s)=(\S*)" % "|".join(serverXmlPasswordAttributes),
+ r"(%s)=(\S*)" % "|".join(server_password_attr),
r'\1="********"'
)
self.do_path_regex_sub(
diff --git a/sos/report/plugins/ufw.py b/sos/report/plugins/ufw.py
index 20fe34a6..3928de67 100644
--- a/sos/report/plugins/ufw.py
+++ b/sos/report/plugins/ufw.py
@@ -9,7 +9,7 @@
from sos.report.plugins import (Plugin, IndependentPlugin, SoSPredicate)
-class ufw(Plugin, IndependentPlugin):
+class Ufw(Plugin, IndependentPlugin):
short_desc = 'Uncomplicated FireWall'
diff --git a/sos/report/plugins/unity.py b/sos/report/plugins/unity.py
index 24bcf8ad..7861cd72 100644
--- a/sos/report/plugins/unity.py
+++ b/sos/report/plugins/unity.py
@@ -9,7 +9,7 @@
from sos.report.plugins import Plugin, UbuntuPlugin
-class unity(Plugin, UbuntuPlugin):
+class Unity(Plugin, UbuntuPlugin):
short_desc = 'Unity'
diff --git a/sos/report/plugins/unpackaged.py b/sos/report/plugins/unpackaged.py
index 00195d2c..36c39890 100644
--- a/sos/report/plugins/unpackaged.py
+++ b/sos/report/plugins/unpackaged.py
@@ -6,11 +6,10 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin
-
+from pathlib import Path
import os
import stat
-from pathlib import Path
+from sos.report.plugins import Plugin, RedHatPlugin
class Unpackaged(Plugin, RedHatPlugin):
@@ -37,14 +36,14 @@ class Unpackaged(Plugin, RedHatPlugin):
for root, dirs, files in os.walk(path, topdown=True):
if exclude:
- for e in exclude:
- dirs[:] = [d for d in dirs if d not in e]
+ for exc in exclude:
+ dirs[:] = [d for d in dirs if d not in exc]
for name in files:
path = self.path_join(root, name)
try:
if stat.S_ISLNK(os.lstat(path).st_mode):
path = Path(path).resolve()
- except Exception:
+ except Exception: # pylint: disable=broad-except
continue
file_list.append(
[self.path_join(root, name), os.path.realpath(path)]
@@ -59,17 +58,17 @@ class Unpackaged(Plugin, RedHatPlugin):
"""Format the unpackaged list as a string.
"""
expanded = []
- for f in files:
- fp = self.path_join(f)
- out = f"{fp}"
+ for file in files:
+ file = self.path_join(file)
+ out = f"{file}"
links = 0
# expand links like
# /usr/bin/jfr -> /etc/alternatives/jfr ->
# /usr/lib/jvm/java-11-openjdk-11.0.17.0.8-2.el9.x86_64/bin/jfr
# but stop at level 10 to prevent potential recursive links
- while self.path_islink(fp) and links < 10:
- fp = os.readlink(fp)
- out += f" -> {fp}"
+ while self.path_islink(file) and links < 10:
+ file = os.readlink(file)
+ out += f" -> {file}"
links += 1
expanded.append(out + '\n')
return expanded
@@ -84,11 +83,11 @@ class Unpackaged(Plugin, RedHatPlugin):
all_frpm = set(
os.path.realpath(x) for x in self.policy.mangle_package_path(
self.policy.package_manager.all_files()
- ) if any([x.startswith(p) for p in paths])
+ ) if any(x.startswith(p) for p in paths)
)
- for d in paths:
- all_fsystem += all_files_system(d)
+ for path in paths:
+ all_fsystem += all_files_system(path)
not_packaged = [x for [x, rp] in all_fsystem if rp not in all_frpm]
not_packaged_expanded = format_output(not_packaged)
diff --git a/sos/report/plugins/vault.py b/sos/report/plugins/vault.py
index 07d788a8..7438c4c9 100644
--- a/sos/report/plugins/vault.py
+++ b/sos/report/plugins/vault.py
@@ -32,8 +32,8 @@ class Vault(Plugin, UbuntuPlugin):
self.add_copy_spec(vault_cfg)
try:
- with open(vault_cfg, 'r') as cf:
- for line in cf.read().splitlines():
+ with open(vault_cfg, 'r', encoding='UTF-8') as cfile:
+ for line in cfile.read().splitlines():
if not line:
continue
words = line.split('=')
diff --git a/sos/report/plugins/vdsm.py b/sos/report/plugins/vdsm.py
index 943d6f44..ad5ee702 100644
--- a/sos/report/plugins/vdsm.py
+++ b/sos/report/plugins/vdsm.py
@@ -8,11 +8,10 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin
-
import glob
import json
import re
+from sos.report.plugins import Plugin, RedHatPlugin
# This configuration is based on vdsm.storage.lvm.LVM_CONF_TEMPLATE.
@@ -132,9 +131,9 @@ class Vdsm(Plugin, RedHatPlugin):
f"vdsm-client StoragePool getSpmStatus "
f"storagepoolID={pool}"
)
- except ValueError as e:
+ except ValueError as err:
self._log_error(
- 'vdsm-client Host getConnectedStoragePools: %s' % (e)
+ 'vdsm-client Host getConnectedStoragePools: %s' % (err)
)
try:
@@ -145,9 +144,9 @@ class Vdsm(Plugin, RedHatPlugin):
self.add_cmd_output([
dump_volume_chains_cmd % uuid for uuid in sd_uuids
])
- except ValueError as e:
+ except ValueError as err:
self._log_error(
- 'vdsm-client Host getStorageDomains: %s' % (e)
+ 'vdsm-client Host getStorageDomains: %s' % (err)
)
def _add_vdsm_forbidden_paths(self):
diff --git a/sos/report/plugins/veritas.py b/sos/report/plugins/veritas.py
index c3e38bda..ea7c53bd 100644
--- a/sos/report/plugins/veritas.py
+++ b/sos/report/plugins/veritas.py
@@ -28,10 +28,10 @@ class Veritas(Plugin, RedHatPlugin):
def setup(self):
""" interface with vrtsexplorer to capture veritas related data """
- r = self.exec_cmd(self.get_option("script"))
- if r['status'] == 0:
+ ret = self.exec_cmd(self.get_option("script"))
+ if ret['status'] == 0:
tarfile = ""
- for line in r['output']:
+ for line in ret['output']:
line = line.strip()
tarfile = self.do_regex_find_all(r"ftp (.*tar.gz)", line)
if len(tarfile) == 1:
diff --git a/sos/report/plugins/vhostmd.py b/sos/report/plugins/vhostmd.py
index e7feac72..4bbcd649 100644
--- a/sos/report/plugins/vhostmd.py
+++ b/sos/report/plugins/vhostmd.py
@@ -9,7 +9,7 @@
from sos.report.plugins import Plugin, RedHatPlugin
-class vhostmd(Plugin, RedHatPlugin):
+class Vhostmd(Plugin, RedHatPlugin):
short_desc = 'vhostmd virtualization metrics collection'
@@ -19,12 +19,12 @@ class vhostmd(Plugin, RedHatPlugin):
packages = ('virt-what',)
def setup(self):
- vw = self.collect_cmd_output("virt-what")['output'].splitlines()
+ vwhat = self.collect_cmd_output("virt-what")['output'].splitlines()
- if not vw:
+ if not vwhat:
return
- if "vmware" in vw or "kvm" in vw or "xen" in vw:
+ if "vmware" in vwhat or "kvm" in vwhat or "xen" in vwhat:
if self.is_installed("vm-dump-metrics"):
# if vm-dump-metrics is installed use it
self.add_cmd_output("vm-dump-metrics",
@@ -37,8 +37,9 @@ class vhostmd(Plugin, RedHatPlugin):
for disk in self.listdir(sysblock):
if "256K" in disk:
dev = disk.split()[0]
- r = self.exec_cmd("dd if=/dev/%s bs=25 count=1" % dev)
- if 'metric' in r['output']:
+ ret = self.exec_cmd("dd if=/dev/%s bs=25 count=1"
+ % dev)
+ if 'metric' in ret['output']:
self.add_cmd_output(
"dd if=/dev/%s bs=256k count=1" % dev,
suggest_filename="virt_metrics"
diff --git a/sos/report/plugins/virsh.py b/sos/report/plugins/virsh.py
index f51d6027..187ff5b5 100644
--- a/sos/report/plugins/virsh.py
+++ b/sos/report/plugins/virsh.py
@@ -59,11 +59,11 @@ class LibvirtClient(Plugin, IndependentPlugin):
# catch the rare exceptions when 'Name' is not found
try:
pos = k_lines[0].split().index('Name')
- except Exception:
+ except Exception: # pylint: disable=broad-except
continue
for j in filter(lambda x: x, k_lines[2:]):
- n = j.split()[pos]
- self.add_cmd_output('%s %s-dumpxml %s' % (cmd, k, n),
+ name = j.split()[pos]
+ self.add_cmd_output('%s %s-dumpxml %s' % (cmd, k, name),
foreground=True)
# cycle through the VMs/domains list, ignore 2 header lines and latest
@@ -72,16 +72,16 @@ class LibvirtClient(Plugin, IndependentPlugin):
if domains_output['status'] == 0:
domains_lines = domains_output['output'].splitlines()[2:]
for domain in filter(lambda x: x, domains_lines):
- d = domain.split()[1]
- for x in ['dumpxml', 'dominfo', 'domblklist']:
- self.add_cmd_output('%s %s %s' % (cmd, x, d),
+ domain = domain.split()[1]
+ for opt in ['dumpxml', 'dominfo', 'domblklist']:
+ self.add_cmd_output('%s %s %s' % (cmd, opt, domain),
foreground=True)
nodedev_output = self.exec_cmd(f"{cmd} nodedev-list", foreground=True)
if nodedev_output['status'] == 0:
- for n in nodedev_output['output'].splitlines():
+ for name in nodedev_output['output'].splitlines():
self.add_cmd_output(
- f"{cmd} nodedev-dumpxml {n}",
+ f"{cmd} nodedev-dumpxml {name}",
foreground=True
)
diff --git a/sos/report/plugins/watchdog.py b/sos/report/plugins/watchdog.py
index bf2dc9cb..b64a98ef 100644
--- a/sos/report/plugins/watchdog.py
+++ b/sos/report/plugins/watchdog.py
@@ -8,9 +8,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
-
from glob import glob
+from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
class Watchdog(Plugin, RedHatPlugin):
@@ -36,7 +35,7 @@ class Watchdog(Plugin, RedHatPlugin):
"""
log_dir = None
- with open(conf_file, 'r') as conf_f:
+ with open(conf_file, 'r', encoding='UTF-8') as conf_f:
for line in conf_f:
line = line.split('#')[0].strip()
diff --git a/sos/report/plugins/xen.py b/sos/report/plugins/xen.py
index a456b27d..46874d43 100644
--- a/sos/report/plugins/xen.py
+++ b/sos/report/plugins/xen.py
@@ -6,9 +6,9 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin
import os
import re
+from sos.report.plugins import Plugin, RedHatPlugin
class Xen(Plugin, RedHatPlugin):
@@ -19,6 +19,7 @@ class Xen(Plugin, RedHatPlugin):
profiles = ('virt',)
def determine_xen_host(self):
+ """ Determine xen host type """
if os.access("/proc/acpi/dsdt", os.R_OK):
result = self.exec_cmd("grep -qi xen /proc/acpi/dsdt")
if result['status'] == 0:
@@ -28,19 +29,20 @@ class Xen(Plugin, RedHatPlugin):
result = self.exec_cmd("grep -q control_d /proc/xen/capabilities")
if result['status'] == 0:
return "dom0"
- else:
- return "domU"
+ return "domU"
return "baremetal"
def check_enabled(self):
- return (self.determine_xen_host() == "baremetal")
+ return self.determine_xen_host() == "baremetal"
def is_running_xenstored(self):
+ """ Check if xenstored is running """
xs_pid = self.exec_cmd("pidof xenstored")['output']
xs_pidnum = re.split('\n$', xs_pid)[0]
return xs_pidnum.isdigit()
def dom_collect_proc(self):
+ """ Collect /proc/xen """
self.add_copy_spec([
"/proc/xen/balloon",
"/proc/xen/capabilities",
@@ -85,11 +87,6 @@ class Xen(Plugin, RedHatPlugin):
else:
# we need tdb instead of xenstore-ls if cannot get it.
self.add_copy_spec("/var/lib/xenstored/tdb")
-
- # FIXME: we *might* want to collect things in /sys/bus/xen*,
- # /sys/class/xen*, /sys/devices/xen*, /sys/modules/blk*,
- # /sys/modules/net*, but I've never heard of them actually being
- # useful, so I'll leave it out for now
else:
# for bare-metal, we don't have to do anything special
return # USEFUL
diff --git a/sos/report/plugins/xfs.py b/sos/report/plugins/xfs.py
index 79e1e272..25b3dfd1 100644
--- a/sos/report/plugins/xfs.py
+++ b/sos/report/plugins/xfs.py
@@ -28,8 +28,8 @@ class Xfs(Plugin, IndependentPlugin):
mounts = '/proc/mounts'
ext_fs_regex = r"^(/dev/.+).+xfs\s+"
for dev in zip(self.do_regex_find_all(ext_fs_regex, mounts)):
- for e in dev:
- parts = e.split(' ')
+ for ext in dev:
+ parts = ext.split(' ')
self.add_cmd_output("xfs_info %s" % (parts[1]),
tags="xfs_info")
self.add_cmd_output("xfs_admin -l -u %s" % (parts[0]))
diff --git a/sos/report/plugins/zvm.py b/sos/report/plugins/zvm.py
index 39b547eb..06c84ffd 100644
--- a/sos/report/plugins/zvm.py
+++ b/sos/report/plugins/zvm.py
@@ -17,11 +17,11 @@ class ZVM(Plugin, IndependentPlugin):
commands = ('vmcp', 'hcp')
def setup(self):
+ vm_cmd = None
- self.vm_cmd = None
for cmd in self.commands:
if is_executable(cmd):
- self.vm_cmd = cmd
+ vm_cmd = cmd
break
# vm commands from dbginfo.sh
@@ -91,7 +91,7 @@ class ZVM(Plugin, IndependentPlugin):
"ind user"
]
- vm_id_out = self.collect_cmd_output("%s q userid" % self.vm_cmd)
+ vm_id_out = self.collect_cmd_output("%s q userid" % vm_cmd)
if vm_id_out['status'] == 0:
vm_id = vm_id_out['output'].split()[0]
vm_cmds.extend([
@@ -99,8 +99,6 @@ class ZVM(Plugin, IndependentPlugin):
"q quickdsp %s" % vm_id
])
- self.add_cmd_output([
- "%s %s" % (self.vm_cmd, vcmd) for vcmd in vm_cmds
- ])
+ self.add_cmd_output(["%s %s" % (vm_cmd, vcmd) for vcmd in vm_cmds])
# vim: set et ts=4 sw=4 :