aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/report/plugins/activemq.py4
-rw-r--r--sos/report/plugins/aide.py4
-rw-r--r--sos/report/plugins/alternatives.py6
-rw-r--r--sos/report/plugins/apache.py5
-rw-r--r--sos/report/plugins/apt.py2
-rw-r--r--sos/report/plugins/arcconf.py2
-rw-r--r--sos/report/plugins/auditd.py4
-rw-r--r--sos/report/plugins/autofs.py4
-rw-r--r--sos/report/plugins/azure.py6
-rw-r--r--sos/report/plugins/boot.py2
-rw-r--r--sos/report/plugins/candlepin.py10
-rw-r--r--sos/report/plugins/ceph_common.py4
-rw-r--r--sos/report/plugins/ceph_mds.py3
-rw-r--r--sos/report/plugins/ceph_mon.py8
-rw-r--r--sos/report/plugins/cgroups.py2
-rw-r--r--sos/report/plugins/chrony.py4
-rw-r--r--sos/report/plugins/clear_containers.py21
-rw-r--r--sos/report/plugins/cman.py3
-rw-r--r--sos/report/plugins/collectd.py13
-rw-r--r--sos/report/plugins/container_log.py6
-rw-r--r--sos/report/plugins/containers_common.py2
-rw-r--r--sos/report/plugins/convert2rhel.py2
-rw-r--r--sos/report/plugins/corosync.py20
-rw-r--r--sos/report/plugins/cs.py14
-rw-r--r--sos/report/plugins/ctdb.py2
-rw-r--r--sos/report/plugins/cxl.py9
-rw-r--r--sos/report/plugins/dellrac.py8
-rw-r--r--sos/report/plugins/dhcp.py4
-rw-r--r--sos/report/plugins/dlm.py3
-rw-r--r--sos/report/plugins/dnf.py5
-rw-r--r--sos/report/plugins/docker.py8
-rw-r--r--sos/report/plugins/docker_distribution.py6
-rw-r--r--sos/report/plugins/dovecot.py8
-rw-r--r--sos/report/plugins/drbd.py2
-rw-r--r--sos/report/plugins/ds.py13
-rw-r--r--sos/report/plugins/ebpf.py24
-rw-r--r--sos/report/plugins/elastic.py9
-rw-r--r--sos/report/plugins/etcd.py2
38 files changed, 136 insertions, 118 deletions
diff --git a/sos/report/plugins/activemq.py b/sos/report/plugins/activemq.py
index de8dcef6..3589cf07 100644
--- a/sos/report/plugins/activemq.py
+++ b/sos/report/plugins/activemq.py
@@ -42,7 +42,7 @@ class ActiveMq(Plugin, DebianPlugin):
class RedHatActiveMq(ActiveMq, RedHatPlugin):
def setup(self):
- super(RedHatActiveMq, self).setup()
+ super().setup()
self.add_copy_spec([
'/etc/sysconfig/activemq',
'/etc/activemq/activemq.xml'
@@ -51,7 +51,7 @@ class RedHatActiveMq(ActiveMq, RedHatPlugin):
class UbuntuActiveMq(ActiveMq, UbuntuPlugin):
def setup(self):
- super(UbuntuActiveMq, self).setup()
+ super().setup()
self.add_copy_spec([
'/etc/activemq',
'/etc/default/activemq'
diff --git a/sos/report/plugins/aide.py b/sos/report/plugins/aide.py
index 9c76d0fa..866ff7dd 100644
--- a/sos/report/plugins/aide.py
+++ b/sos/report/plugins/aide.py
@@ -36,7 +36,7 @@ class RedHatAide(Aide, RedHatPlugin):
conf_file = "/etc/aide.conf"
def setup(self):
- super(RedHatAide, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/aide.conf",
"/etc/logrotate.d/aide"
@@ -47,7 +47,7 @@ class DebianAide(Aide, DebianPlugin, UbuntuPlugin):
conf_file = "/etc/aide/aide.conf"
def setup(self):
- super(DebianAide, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/aide/",
"/etc/default/aide"
diff --git a/sos/report/plugins/alternatives.py b/sos/report/plugins/alternatives.py
index e3b3911e..7c4dc1ae 100644
--- a/sos/report/plugins/alternatives.py
+++ b/sos/report/plugins/alternatives.py
@@ -15,6 +15,8 @@ class Alternatives(Plugin):
short_desc = 'System alternatives'
plugin_name = 'alternatives'
+ alternatives_cmd = None
+ alternatives_list = None
def setup(self):
@@ -49,7 +51,7 @@ class RedHatAlternatives(Alternatives, RedHatPlugin):
def setup(self):
- super(RedHatAlternatives, self).setup()
+ super().setup()
self.add_cmd_tags({
"alternatives --display java.*": 'display_java',
@@ -68,7 +70,7 @@ class UbuntuAlternatives(Alternatives, UbuntuPlugin):
def setup(self):
- super(UbuntuAlternatives, self).setup()
+ super().setup()
if self.get_option("all_logs"):
self.add_copy_spec([
diff --git a/sos/report/plugins/apache.py b/sos/report/plugins/apache.py
index 529210a7..3088355b 100644
--- a/sos/report/plugins/apache.py
+++ b/sos/report/plugins/apache.py
@@ -30,6 +30,7 @@ class Apache(Plugin):
profiles = ('webserver', 'openshift')
packages = ('httpd',)
files = ('/var/www/',)
+ apachepkg = None
option_list = [
PluginOpt(name="log", default=False, desc="gathers all apache logs")
@@ -90,7 +91,7 @@ class RedHatApache(Apache, RedHatPlugin):
"/var/log/httpd/ssl_error_log": 'httpd_ssl_error_log'
})
- super(RedHatApache, self).setup()
+ super().setup()
# httpd versions, including those used for JBoss Web Server
vers = ['', '22', '24']
@@ -137,7 +138,7 @@ class DebianApache(Apache, DebianPlugin, UbuntuPlugin):
apachepkg = 'apache2'
def setup(self):
- super(DebianApache, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/apache2/*",
"/etc/default/apache2"
diff --git a/sos/report/plugins/apt.py b/sos/report/plugins/apt.py
index 0bdaf894..36b3bf1c 100644
--- a/sos/report/plugins/apt.py
+++ b/sos/report/plugins/apt.py
@@ -46,7 +46,7 @@ class Apt(Plugin, DebianPlugin, UbuntuPlugin):
)
def postproc(self):
- super(Apt, self).postproc()
+ super().postproc()
self.do_file_sub(
"/etc/apt/sources.list",
r"(deb\shttp(s)?://)\S+:\S+(@.*)",
diff --git a/sos/report/plugins/arcconf.py b/sos/report/plugins/arcconf.py
index 8eb9cd7b..1cfcf5a8 100644
--- a/sos/report/plugins/arcconf.py
+++ b/sos/report/plugins/arcconf.py
@@ -15,7 +15,7 @@ import re
from sos.report.plugins import Plugin, IndependentPlugin
-class arcconf(Plugin, IndependentPlugin):
+class ArcConf(Plugin, IndependentPlugin):
short_desc = 'arcconf Integrated RAID adapter information'
diff --git a/sos/report/plugins/auditd.py b/sos/report/plugins/auditd.py
index 5a1e1524..59bb206b 100644
--- a/sos/report/plugins/auditd.py
+++ b/sos/report/plugins/auditd.py
@@ -37,8 +37,8 @@ class Auditd(Plugin, IndependentPlugin):
config_file = "/etc/audit/auditd.conf"
log_file = "/var/log/audit/audit.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/autofs.py b/sos/report/plugins/autofs.py
index bf333ba8..2d7c3a9d 100644
--- a/sos/report/plugins/autofs.py
+++ b/sos/report/plugins/autofs.py
@@ -85,7 +85,7 @@ class Autofs(Plugin):
class RedHatAutofs(Autofs, RedHatPlugin):
def setup(self):
- super(RedHatAutofs, self).setup()
+ super().setup()
if self.get_option("verify"):
self.add_cmd_output("rpm -qV autofs")
@@ -93,7 +93,7 @@ class RedHatAutofs(Autofs, RedHatPlugin):
class DebianAutofs(Autofs, DebianPlugin, UbuntuPlugin):
def setup(self):
- super(DebianAutofs, self).setup()
+ super().setup()
self.add_cmd_output("dpkg-query -s autofs")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/azure.py b/sos/report/plugins/azure.py
index 253b9e7f..3939f47a 100644
--- a/sos/report/plugins/azure.py
+++ b/sos/report/plugins/azure.py
@@ -8,8 +8,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, UbuntuPlugin, RedHatPlugin
import os
+from sos.report.plugins import Plugin, UbuntuPlugin, RedHatPlugin
class Azure(Plugin, UbuntuPlugin):
@@ -36,7 +36,7 @@ class Azure(Plugin, UbuntuPlugin):
# extensions and there is no standard log filename format
limit = self.get_option("log_size")
- for path, subdirs, files in os.walk("/var/log/azure"):
+ for path, _, files in os.walk("/var/log/azure"):
for name in files:
self.add_copy_spec(self.path_join(path, name), sizelimit=limit)
@@ -50,7 +50,7 @@ class Azure(Plugin, UbuntuPlugin):
class RedHatAzure(Azure, RedHatPlugin):
def setup(self):
- super(RedHatAzure, self).setup()
+ super().setup()
if self.path_isfile('/etc/yum.repos.d/rh-cloud.repo'):
curl_cmd = ('curl -s -m 5 -vvv '
diff --git a/sos/report/plugins/boot.py b/sos/report/plugins/boot.py
index 8752eab2..9bb1b28e 100644
--- a/sos/report/plugins/boot.py
+++ b/sos/report/plugins/boot.py
@@ -6,8 +6,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt
from glob import glob
+from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt
class Boot(Plugin, IndependentPlugin):
diff --git a/sos/report/plugins/candlepin.py b/sos/report/plugins/candlepin.py
index 9c14ea2d..a4961ced 100644
--- a/sos/report/plugins/candlepin.py
+++ b/sos/report/plugins/candlepin.py
@@ -8,9 +8,9 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin
-from pipes import quote
from re import match
+from shlex import quote
+from sos.report.plugins import Plugin, RedHatPlugin
class Candlepin(Plugin, RedHatPlugin):
@@ -20,6 +20,10 @@ class Candlepin(Plugin, RedHatPlugin):
plugin_name = 'candlepin'
packages = ('candlepin',)
+ dbhost = None
+ dbpasswd = None
+ env = None
+
def setup(self):
# for external DB, search in /etc/candlepin/candlepin.conf for:
# org.quartz.dataSource.myDS.URL=..
@@ -30,7 +34,7 @@ class Candlepin(Plugin, RedHatPlugin):
self.dbpasswd = ""
cfg_file = "/etc/candlepin/candlepin.conf"
try:
- with open(cfg_file, 'r') as cfile:
+ with open(cfg_file, 'r', encoding='UTF--8') as cfile:
candle_lines = cfile.read().splitlines()
for line in candle_lines:
# skip empty lines and lines with comments
diff --git a/sos/report/plugins/ceph_common.py b/sos/report/plugins/ceph_common.py
index 444e0f52..eb4282bd 100644
--- a/sos/report/plugins/ceph_common.py
+++ b/sos/report/plugins/ceph_common.py
@@ -6,11 +6,11 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
from socket import gethostname
+from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
-class Ceph_Common(Plugin, RedHatPlugin, UbuntuPlugin):
+class CephCommon(Plugin, RedHatPlugin, UbuntuPlugin):
short_desc = 'CEPH common'
diff --git a/sos/report/plugins/ceph_mds.py b/sos/report/plugins/ceph_mds.py
index 94f0f69c..a5a5edeb 100644
--- a/sos/report/plugins/ceph_mds.py
+++ b/sos/report/plugins/ceph_mds.py
@@ -10,6 +10,7 @@ from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class CephMDS(Plugin, RedHatPlugin, UbuntuPlugin):
+
short_desc = 'CEPH mds'
plugin_name = 'ceph_mds'
profiles = ('storage', 'virt', 'container', 'ceph')
@@ -84,7 +85,7 @@ class CephMDS(Plugin, RedHatPlugin, UbuntuPlugin):
# If containerized, run commands in containers
try:
cname = self.get_all_containers_by_regex("ceph-mds*")[0][1]
- except Exception:
+ except Exception: # pylint: disable=broad-except
cname = None
self.add_cmd_output([
diff --git a/sos/report/plugins/ceph_mon.py b/sos/report/plugins/ceph_mon.py
index fea3b08b..8a41d463 100644
--- a/sos/report/plugins/ceph_mon.py
+++ b/sos/report/plugins/ceph_mon.py
@@ -161,12 +161,14 @@ class CephMON(Plugin, RedHatPlugin, UbuntuPlugin):
)
def get_ceph_version(self):
+ """ Get the versions of running daemons """
+
ver = self.exec_cmd('ceph --version')
if ver['status'] == 0:
try:
_ver = ver['output'].split()[2]
return int(_ver.split('.')[0])
- except Exception as err:
+ except Exception as err: # pylint: disable=broad-except
self._log_debug(f"Could not determine ceph version: {err}")
self._log_error(
'Failed to find ceph version, command collection will be limited'
@@ -174,6 +176,8 @@ class CephMON(Plugin, RedHatPlugin, UbuntuPlugin):
return 0
def get_ceph_ids(self):
+ """ Get the IDs of the Ceph daemons """
+
ceph_ids = []
# ceph version 14 correlates to RHCS 4
if self.ceph_version in (14, 15):
@@ -200,7 +204,7 @@ class CephMON(Plugin, RedHatPlugin, UbuntuPlugin):
ret = re.search(r'(\s*mon: .* quorum) (.*) (\(.*\))',
stats['output'])
ceph_ids.extend(ret.groups()[1].split(','))
- except Exception as err:
+ except Exception as err: # pylint: disable=broad-except
self._log_debug(f"id determination failed: {err}")
return ceph_ids
diff --git a/sos/report/plugins/cgroups.py b/sos/report/plugins/cgroups.py
index cc1bf20b..35075d83 100644
--- a/sos/report/plugins/cgroups.py
+++ b/sos/report/plugins/cgroups.py
@@ -38,7 +38,7 @@ class Cgroups(Plugin, DebianPlugin, UbuntuPlugin, CosPlugin):
class RedHatCgroups(Cgroups, RedHatPlugin):
def setup(self):
- super(RedHatCgroups, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/sysconfig/cgconfig",
"/etc/sysconfig/cgred",
diff --git a/sos/report/plugins/chrony.py b/sos/report/plugins/chrony.py
index d8ff3d7e..476b655b 100644
--- a/sos/report/plugins/chrony.py
+++ b/sos/report/plugins/chrony.py
@@ -32,7 +32,7 @@ class Chrony(Plugin):
class RedHatChrony(Chrony, RedHatPlugin):
def setup(self):
- super(RedHatChrony, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/chrony.conf",
"/var/lib/chrony/drift"
@@ -42,7 +42,7 @@ class RedHatChrony(Chrony, RedHatPlugin):
class DebianChrony(Chrony, DebianPlugin, UbuntuPlugin):
def setup(self):
- super(DebianChrony, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/chrony/chrony.conf",
"/etc/chrony/conf.d",
diff --git a/sos/report/plugins/clear_containers.py b/sos/report/plugins/clear_containers.py
index 068d4255..7f1f2dfb 100644
--- a/sos/report/plugins/clear_containers.py
+++ b/sos/report/plugins/clear_containers.py
@@ -7,7 +7,6 @@
# See the LICENSE file in the source distribution for further information.
import re
-
from sos.report.plugins import Plugin, IndependentPlugin
@@ -21,8 +20,10 @@ class ClearContainers(Plugin, IndependentPlugin):
runtime = 'cc-runtime'
packages = (runtime,)
services = ('cc-proxy',)
+ loglimit = None
- def attach_cc_config_files(self):
+ def collect_cc_config_files(self):
+ """ Collect Clear Containers config files """
# start with the default file locations
config_files = [
@@ -43,7 +44,9 @@ class ClearContainers(Plugin, IndependentPlugin):
self.add_copy_spec(config_files)
- def attach_cc_log_files(self):
+ def collect_cc_log_files(self):
+ """ Collect Clear Containers log files """
+
# start with the default global log
log_files = [
'/var/lib/clear-containers/runtime/runtime.log'
@@ -63,19 +66,19 @@ class ClearContainers(Plugin, IndependentPlugin):
# get a unique list of log files
log_files = set(log_files)
- self.add_copy_spec(log_files, self.limit)
+ self.add_copy_spec(log_files, self.loglimit)
def setup(self):
- self.limit = self.get_option("log_size")
+ self.loglimit = self.get_option("log_size")
if self.get_option("all_logs"):
- # no limit on amount of data recorded
- self.limit = None
+ # no loglimit on amount of data recorded
+ self.loglimit = None
self.add_cmd_output(f"{self.runtime} cc-env")
- self.attach_cc_config_files()
+ self.collect_cc_config_files()
- self.attach_cc_log_files()
+ self.collect_cc_log_files()
self.add_journal(identifier="cc-shim")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/cman.py b/sos/report/plugins/cman.py
index f749a6bb..75825720 100644
--- a/sos/report/plugins/cman.py
+++ b/sos/report/plugins/cman.py
@@ -6,8 +6,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin
from glob import glob
+from sos.report.plugins import Plugin, RedHatPlugin
class Cman(Plugin, RedHatPlugin):
@@ -61,6 +61,5 @@ class Cman(Plugin, RedHatPlugin):
r"(.*secret\s*=\s*)\S+",
r"\1******"
)
- return
# vim: et ts=4 sw=4
diff --git a/sos/report/plugins/collectd.py b/sos/report/plugins/collectd.py
index 65355543..0ecb19bf 100644
--- a/sos/report/plugins/collectd.py
+++ b/sos/report/plugins/collectd.py
@@ -34,15 +34,16 @@ class Collectd(Plugin, IndependentPlugin):
+ '*.conf',
])
- p = re.compile('^LoadPlugin.*')
+ plugin = re.compile('^LoadPlugin.*')
try:
- with open(self.path_join("/etc/collectd.conf"), 'r') as f:
- for line in f:
- if p.match(line):
+ cfile = self.path_join("/etc/collectd.conf")
+ with open(cfile, 'r', encoding='UTF-8') as file:
+ for line in file:
+ if plugin.match(line):
self.add_alert("Active Plugin found: %s" %
line.split()[-1])
- except IOError as e:
- self._log_warn("could not open /etc/collectd.conf: %s" % e)
+ except IOError as err:
+ self._log_warn("could not open /etc/collectd.conf: %s" % err)
def postproc(self):
# add these to protect_keys if need be:
diff --git a/sos/report/plugins/container_log.py b/sos/report/plugins/container_log.py
index e8dedad2..98d9637a 100644
--- a/sos/report/plugins/container_log.py
+++ b/sos/report/plugins/container_log.py
@@ -8,8 +8,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, IndependentPlugin
import os
+from sos.report.plugins import Plugin, IndependentPlugin
class ContainerLog(Plugin, IndependentPlugin):
@@ -28,7 +28,7 @@ class ContainerLog(Plugin, IndependentPlugin):
def collect_subdirs(self, root=logdir):
"""Collect *.log files from subdirs of passed root path
"""
- for dirName, _, _ in os.walk(root):
- self.add_copy_spec(self.path_join(dirName, '*.log'))
+ for dir_name, _, _ in os.walk(root):
+ self.add_copy_spec(self.path_join(dir_name, '*.log'))
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/containers_common.py b/sos/report/plugins/containers_common.py
index a6e577e9..39e9b1a0 100644
--- a/sos/report/plugins/containers_common.py
+++ b/sos/report/plugins/containers_common.py
@@ -8,8 +8,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin, PluginOpt
import os
+from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin, PluginOpt
class ContainersCommon(Plugin, RedHatPlugin, UbuntuPlugin):
diff --git a/sos/report/plugins/convert2rhel.py b/sos/report/plugins/convert2rhel.py
index 1f9670bd..2ea2c523 100644
--- a/sos/report/plugins/convert2rhel.py
+++ b/sos/report/plugins/convert2rhel.py
@@ -9,7 +9,7 @@
from sos.report.plugins import Plugin, RedHatPlugin
-class convert2rhel(Plugin, RedHatPlugin):
+class Convert2RHEL(Plugin, RedHatPlugin):
short_desc = 'Convert2RHEL'
plugin_name = 'convert2rhel'
diff --git a/sos/report/plugins/corosync.py b/sos/report/plugins/corosync.py
index 2742f129..35afbe85 100644
--- a/sos/report/plugins/corosync.py
+++ b/sos/report/plugins/corosync.py
@@ -6,8 +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 Corosync(Plugin):
@@ -48,12 +48,13 @@ class Corosync(Plugin):
# (it isnt precise but sufficient)
pattern = r'^\s*(logging.)?logfile:\s*(\S+)$'
try:
- with open(self.path_join("/etc/corosync/corosync.conf"), 'r') as f:
- for line in f:
+ cconf = self.path_join("/etc/corosync/corosync.conf")
+ with open(cconf, 'r', encoding='UTF-8') as file:
+ for line in file:
if re.match(pattern, line):
self.add_copy_spec(re.search(pattern, line).group(2))
- except IOError as e:
- self._log_warn("could not read from %s: %s" % (corosync_conf, e))
+ except IOError as err: # pylint: disable=broad-except
+ self._log_warn("could not read from %s: %s" % (corosync_conf, err))
def postproc(self):
self.do_cmd_output_sub(
@@ -64,16 +65,11 @@ class Corosync(Plugin):
class RedHatCorosync(Corosync, RedHatPlugin):
-
- def setup(self):
- super(RedHatCorosync, self).setup()
+ """ Parent class Corosync's setup() will be called """
class DebianCorosync(Corosync, DebianPlugin, UbuntuPlugin):
-
- def setup(self):
- super(DebianCorosync, self).setup()
-
+ """ Parent class Corosync's setup() will be called """
files = ('/usr/sbin/corosync',)
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/cs.py b/sos/report/plugins/cs.py
index 9a2d964f..2a1e0821 100644
--- a/sos/report/plugins/cs.py
+++ b/sos/report/plugins/cs.py
@@ -10,8 +10,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin
from glob import glob
+from sos.report.plugins import Plugin, RedHatPlugin
class CertificateSystem(Plugin, RedHatPlugin):
@@ -37,19 +37,23 @@ class CertificateSystem(Plugin, RedHatPlugin):
)
def checkversion(self):
+ """ Get Certificate System version """
if (self.is_installed("redhat-cs") or
self.path_exists("/opt/redhat-cs")):
return 71
- elif self.is_installed("rhpki-common") or \
- len(glob("/var/lib/rhpki-*")):
+
+ if self.is_installed("rhpki-common") or glob("/var/lib/rhpki-*"):
return 73
+
# 8 should cover dogtag
- elif self.is_installed("pki-common"):
+ if self.is_installed("pki-common"):
return 8
- elif self.is_installed("redhat-pki") or \
+
+ if self.is_installed("redhat-pki") or \
self.is_installed("dogtag-pki") or \
self.is_installed("pki-base"):
return 9
+
return False
def setup(self):
diff --git a/sos/report/plugins/ctdb.py b/sos/report/plugins/ctdb.py
index 3def321e..a25c43ed 100644
--- a/sos/report/plugins/ctdb.py
+++ b/sos/report/plugins/ctdb.py
@@ -44,7 +44,7 @@ class Ctdb(Plugin, DebianPlugin, UbuntuPlugin):
class RedHatCtdb(Ctdb, RedHatPlugin):
def setup(self):
- super(RedHatCtdb, self).setup()
+ super().setup()
self.add_copy_spec("/etc/sysconfig/ctdb")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/cxl.py b/sos/report/plugins/cxl.py
index 908a14b0..7d01d6bf 100644
--- a/sos/report/plugins/cxl.py
+++ b/sos/report/plugins/cxl.py
@@ -9,7 +9,7 @@
from sos.report.plugins import Plugin, IndependentPlugin
-class cxl(Plugin, IndependentPlugin):
+class Cxl(Plugin, IndependentPlugin):
"""This plugin collects data from Compute Express Link (CXL) devices
"""
@@ -32,11 +32,8 @@ class cxl(Plugin, IndependentPlugin):
"daxctl list -iDRM"
])
- """ Use the cxl-list(1) command to collect data about
- all CXL devices.
-
- Output is JSON formatted
- """
+ # Use the cxl-list(1) command to collect data about all CXL devices.
+ # Output is JSON formatted.
self.add_cmd_output([
"cxl version",
"cxl list",
diff --git a/sos/report/plugins/dellrac.py b/sos/report/plugins/dellrac.py
index cf6bd219..00f92aa0 100644
--- a/sos/report/plugins/dellrac.py
+++ b/sos/report/plugins/dellrac.py
@@ -34,9 +34,11 @@ class DellRAC(Plugin, IndependentPlugin):
self.do_debug()
def do_debug(self):
- # ensure the sos_commands/dellrac directory does exist in either case
- # as we will need to run the command at that dir, and also ensure
- # logpath is properly populated in either case as well
+ """
+ Ensure the sos_commands/dellrac directory does exist in either case
+ as we will need to run the command at that dir, and also ensure
+ logpath is properly populated in either case as well.
+ """
try:
logpath = self.get_cmd_output_path()
except FileExistsError:
diff --git a/sos/report/plugins/dhcp.py b/sos/report/plugins/dhcp.py
index 33906b12..329bd825 100644
--- a/sos/report/plugins/dhcp.py
+++ b/sos/report/plugins/dhcp.py
@@ -23,7 +23,7 @@ class RedHatDhcp(Dhcp, RedHatPlugin):
packages = ('dhcp',)
def setup(self):
- super(RedHatDhcp, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/dhcpd.conf",
"/etc/dhcp"
@@ -36,7 +36,7 @@ class UbuntuDhcp(Dhcp, UbuntuPlugin):
packages = ('udhcpd',)
def setup(self):
- super(UbuntuDhcp, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/default/udhcpd",
"/etc/udhcpd.conf"
diff --git a/sos/report/plugins/dlm.py b/sos/report/plugins/dlm.py
index b34b5b74..b492c2a4 100644
--- a/sos/report/plugins/dlm.py
+++ b/sos/report/plugins/dlm.py
@@ -6,8 +6,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt
import re
+from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt
class Dlm(Plugin, IndependentPlugin):
@@ -34,6 +34,7 @@ class Dlm(Plugin, IndependentPlugin):
self.do_lockdump()
def do_lockdump(self):
+ """ Do dlm lock dumps """
dlm_tool = "dlm_tool ls"
result = self.collect_cmd_output(dlm_tool)
if result["status"] != 0:
diff --git a/sos/report/plugins/dnf.py b/sos/report/plugins/dnf.py
index 5250e2cb..11f7ec66 100644
--- a/sos/report/plugins/dnf.py
+++ b/sos/report/plugins/dnf.py
@@ -38,6 +38,7 @@ class DNFPlugin(Plugin, RedHatPlugin):
]
def get_modules_info(self, modules):
+ """ Get DN module information """
if not modules:
return
# take just lines with the module names, i.e. containing "[i]" and
@@ -134,8 +135,8 @@ class DNFPlugin(Plugin, RedHatPlugin):
# Whitespace around '=' is allowed.
regexp = r"(password(\s)*=(\s)*)(\S+)\n"
repl = r"\1********\n"
- for f in ["/etc/yum.repos.d/*", "/etc/dnf/vars/*"]:
- self.do_path_regex_sub(f, regexp, repl)
+ for file in ["/etc/yum.repos.d/*", "/etc/dnf/vars/*"]:
+ self.do_path_regex_sub(file, regexp, repl)
# Scrub password and proxy_password from /etc/dnf/dnf.conf.
# This uses the same regex patterns as above.
diff --git a/sos/report/plugins/docker.py b/sos/report/plugins/docker.py
index b6cadfb4..a483b292 100644
--- a/sos/report/plugins/docker.py
+++ b/sos/report/plugins/docker.py
@@ -74,8 +74,8 @@ class Docker(Plugin, CosPlugin):
nets = self.collect_cmd_output('docker network ls')
if nets['status'] == 0:
- n = [n.split()[1] for n in nets['output'].splitlines()[1:]]
- for net in n:
+ networks = [n.split()[1] for n in nets['output'].splitlines()[1:]]
+ for net in networks:
self.add_cmd_output("docker network inspect %s" % net)
containers = [
@@ -126,7 +126,7 @@ class RedHatDocker(Docker, RedHatPlugin):
'docker-ce', 'docker-ee')
def setup(self):
- super(RedHatDocker, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/udev/rules.d/80-docker.rules",
@@ -139,7 +139,7 @@ class UbuntuDocker(Docker, UbuntuPlugin, DebianPlugin):
packages = ('docker.io', 'docker-engine', 'docker-ce', 'docker-ee')
def setup(self):
- super(UbuntuDocker, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/default/docker",
"/run/docker/libcontainerd/containerd/events.log"
diff --git a/sos/report/plugins/docker_distribution.py b/sos/report/plugins/docker_distribution.py
index e760f252..31301092 100644
--- a/sos/report/plugins/docker_distribution.py
+++ b/sos/report/plugins/docker_distribution.py
@@ -21,8 +21,8 @@ class DockerDistribution(Plugin):
self.add_journal('docker-distribution')
conf = self.path_join('/etc/docker-distribution/registry/config.yml')
if self.path_exists(conf):
- with open(conf) as f:
- for line in f:
+ with open(conf, encoding='UTF-8') as file:
+ for line in file:
if 'rootdirectory' in line:
loc = line.split()[1]
self.add_cmd_output('tree ' + loc)
@@ -34,4 +34,4 @@ class RedHatDockerDistribution(DockerDistribution, RedHatPlugin):
def setup(self):
self.add_forbidden_path('/etc/docker-distribution/registry/*passwd')
- super(RedHatDockerDistribution, self).setup()
+ super().setup()
diff --git a/sos/report/plugins/dovecot.py b/sos/report/plugins/dovecot.py
index 334e787d..8ee6a9d7 100644
--- a/sos/report/plugins/dovecot.py
+++ b/sos/report/plugins/dovecot.py
@@ -22,18 +22,14 @@ class Dovecot(Plugin):
class RedHatDovecot(Dovecot, RedHatPlugin):
-
- def setup(self):
- super(RedHatDovecot, self).setup()
+ """ Parent class Dovecot's setup() will be called """
packages = ('dovecot', )
files = ('/etc/dovecot.conf',)
class DebianDovecot(Dovecot, DebianPlugin, UbuntuPlugin):
-
- def setup(self):
- super(DebianDovecot, self).setup()
+ """ Parent class Dovecot's setup() will be called """
files = ('/etc/dovecot/README',)
diff --git a/sos/report/plugins/drbd.py b/sos/report/plugins/drbd.py
index 0293f43a..ecd68177 100644
--- a/sos/report/plugins/drbd.py
+++ b/sos/report/plugins/drbd.py
@@ -9,7 +9,7 @@
from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
-class drbd(Plugin, RedHatPlugin, UbuntuPlugin):
+class DRDB(Plugin, RedHatPlugin, UbuntuPlugin):
short_desc = 'Distributed Replicated Block Device (DRBD)'
diff --git a/sos/report/plugins/ds.py b/sos/report/plugins/ds.py
index 3fc85145..b05a0491 100644
--- a/sos/report/plugins/ds.py
+++ b/sos/report/plugins/ds.py
@@ -24,12 +24,15 @@ class DirectoryServer(Plugin, RedHatPlugin):
packages = ('redhat-ds-base', 'redhat-ds-7')
def check_version(self):
+ """ Get Directory Server version """
if self.is_installed("redhat-ds-base") or \
self.path_exists("/etc/dirsrv"):
return "ds8"
- elif self.is_installed("redhat-ds-7") or \
+
+ if self.is_installed("redhat-ds-7") or \
self.path_exists("/opt/redhat-ds"):
return "ds7"
+
return False
def setup(self):
@@ -44,11 +47,11 @@ class DirectoryServer(Plugin, RedHatPlugin):
])
try:
- for d in self.listdir("/etc/dirsrv"):
- if d[0:5] == 'slapd':
- certpath = self.path_join("/etc/dirsrv", d)
+ for dsrv in self.listdir("/etc/dirsrv"):
+ if dsrv[0:5] == 'slapd':
+ certpath = self.path_join("/etc/dirsrv", dsrv)
self.add_cmd_output("certutil -L -d %s" % certpath)
- self.add_cmd_output("dsctl %s healthcheck" % d)
+ self.add_cmd_output("dsctl %s healthcheck" % dsrv)
except OSError:
self._log_warn("could not list /etc/dirsrv")
diff --git a/sos/report/plugins/ebpf.py b/sos/report/plugins/ebpf.py
index 6c5f7dee..4bd6a657 100644
--- a/sos/report/plugins/ebpf.py
+++ b/sos/report/plugins/ebpf.py
@@ -6,8 +6,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt
import json
+from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt
class Ebpf(Plugin, IndependentPlugin):
@@ -22,27 +22,29 @@ class Ebpf(Plugin, IndependentPlugin):
]
def get_bpftool_prog_ids(self, prog_json):
+ """ Collect the list of program IDs """
out = []
try:
prog_data = json.loads(prog_json)
- except Exception as e:
- self._log_info("Could not parse bpftool prog list as JSON: %s" % e)
+ except Exception as err: # pylint: disable=broad-except
+ self._log_info("Couldn't parse bpftool prog list: %s" % err)
return out
- for item in range(len(prog_data)):
- if "id" in prog_data[item]:
- out.append(prog_data[item]["id"])
+ for _, item in enumerate(prog_data):
+ if "id" in item:
+ out.append(item["id"])
return out
def get_bpftool_map_ids(self, map_json):
+ """ Collect the list of mapIDs """
out = []
try:
map_data = json.loads(map_json)
- except Exception as e:
- self._log_info("Could not parse bpftool map list as JSON: %s" % e)
+ except Exception as err: # pylint: disable=broad-except
+ self._log_info("Could not parse bpftool map list: %s" % err)
return out
- for item in range(len(map_data)):
- if "id" in map_data[item]:
- out.append(map_data[item]["id"])
+ for _, item in enumerate(map_data):
+ if "id" in item:
+ out.append(item["id"])
return out
def setup(self):
diff --git a/sos/report/plugins/elastic.py b/sos/report/plugins/elastic.py
index edb80159..1a8803d5 100644
--- a/sos/report/plugins/elastic.py
+++ b/sos/report/plugins/elastic.py
@@ -8,8 +8,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 Elastic(Plugin, IndependentPlugin):
@@ -21,10 +21,11 @@ class Elastic(Plugin, IndependentPlugin):
packages = ('elasticsearch',)
def get_hostname_port(self, els_config_file):
+ """ Get hostname and port number """
hostname = "localhost"
port = "9200"
try:
- with open(els_config_file) as fread:
+ with open(els_config_file, encoding='UTF-8') as fread:
for line in fread:
network_host = re.search(r'(^network.host):(.*)', line)
network_port = re.search(r'(^http.port):(.*)', line)
@@ -34,8 +35,8 @@ class Elastic(Plugin, IndependentPlugin):
continue
if network_port and len(network_port.groups()) == 2:
port = network_port.groups()[-1].strip()
- except Exception as e:
- self._log_info("Failed to parse %s: %s" % (els_config_file, e))
+ except Exception as err: # pylint: disable=broad-except
+ self._log_info("Failed to parse %s: %s" % (els_config_file, err))
return hostname, port
def setup(self):
diff --git a/sos/report/plugins/etcd.py b/sos/report/plugins/etcd.py
index 6b76674b..08cd19d3 100644
--- a/sos/report/plugins/etcd.py
+++ b/sos/report/plugins/etcd.py
@@ -12,7 +12,7 @@
from sos.report.plugins import Plugin, RedHatPlugin
-class etcd(Plugin, RedHatPlugin):
+class Etcd(Plugin, RedHatPlugin):
"""The etcd plugin collects information from the etcd key-value store. It
is primarily used by Kubernetes/OpenShift clusters and is often run inside
a container within the cluster.