aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPonnuvel Palaniyappan <pponnuvel@gmail.com>2024-02-28 12:55:58 +0000
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-03-07 10:46:03 -0500
commitf08a3600f4cba67c1534ce018419aaf34412d603 (patch)
tree0d8d96fac49920af1aeabf20a2df951d13d6ffcf
parent69a38a885c93b0b28b35fb794035e225da11cb1d (diff)
downloadsos-f08a3600f4cba67c1534ce018419aaf34412d603.tar.gz
[plugins] Fix Pylint and PEP8 issues
Continuation of #3530. Signed-off-by: Ponnuvel Palaniyappan <pponnuvel@gmail.com>
-rw-r--r--sos/report/plugins/named.py12
-rw-r--r--sos/report/plugins/navicli.py34
-rw-r--r--sos/report/plugins/networking.py101
-rw-r--r--sos/report/plugins/networkmanager.py4
-rw-r--r--sos/report/plugins/nfsganesha.py2
-rw-r--r--sos/report/plugins/npm.py3
-rw-r--r--sos/report/plugins/nscd.py10
-rw-r--r--sos/report/plugins/ntp.py4
-rw-r--r--sos/report/plugins/omnipath_client.py2
-rw-r--r--sos/report/plugins/omsa.py2
-rw-r--r--sos/report/plugins/openshift.py15
-rw-r--r--sos/report/plugins/openssl.py4
-rw-r--r--sos/report/plugins/openstack_aodh.py4
-rw-r--r--sos/report/plugins/openstack_ceilometer.py3
-rw-r--r--sos/report/plugins/openstack_cinder.py6
-rw-r--r--sos/report/plugins/openstack_database.py8
-rw-r--r--sos/report/plugins/openstack_edpm.py1
-rw-r--r--sos/report/plugins/openstack_glance.py3
-rw-r--r--sos/report/plugins/openstack_gnocchi.py5
-rw-r--r--sos/report/plugins/openstack_heat.py3
-rw-r--r--sos/report/plugins/openstack_horizon.py6
-rw-r--r--sos/report/plugins/openstack_instack.py34
-rw-r--r--sos/report/plugins/openstack_ironic.py13
-rw-r--r--sos/report/plugins/openstack_keystone.py7
-rw-r--r--sos/report/plugins/openstack_manila.py5
-rw-r--r--sos/report/plugins/openstack_neutron.py7
-rw-r--r--sos/report/plugins/openstack_nova.py20
-rw-r--r--sos/report/plugins/openstack_novajoin.py2
-rw-r--r--sos/report/plugins/openstack_octavia.py8
-rw-r--r--sos/report/plugins/openstack_placement.py4
-rw-r--r--sos/report/plugins/openstack_sahara.py6
-rw-r--r--sos/report/plugins/openstack_swift.py1
-rw-r--r--sos/report/plugins/openstack_tripleo.py1
-rw-r--r--sos/report/plugins/openstack_trove.py7
-rw-r--r--sos/report/plugins/opensvc.py1
-rw-r--r--sos/report/plugins/openvswitch.py367
-rw-r--r--sos/report/plugins/origin.py5
-rw-r--r--sos/report/plugins/ovirt.py14
-rw-r--r--sos/report/plugins/ovirt_engine_backup.py4
-rw-r--r--sos/report/plugins/ovn_central.py49
-rw-r--r--sos/report/plugins/ovn_host.py26
-rw-r--r--sos/report/plugins/pam.py5
-rw-r--r--sos/report/plugins/pci.py1
43 files changed, 424 insertions, 395 deletions
diff --git a/sos/report/plugins/named.py b/sos/report/plugins/named.py
index 2786934c..229fd1cb 100644
--- a/sos/report/plugins/named.py
+++ b/sos/report/plugins/named.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
from os.path import join, normpath
+from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Named(Plugin):
@@ -42,8 +42,8 @@ class Named(Plugin):
config_file)
if directory_list:
return normpath(directory_list[0])
- else:
- return ""
+
+ return ""
def postproc(self):
match = r"(\s*arg \"password )[^\"]*"
@@ -60,12 +60,11 @@ class RedHatNamed(Named, RedHatPlugin):
packages = ('bind',)
def setup(self):
- super(RedHatNamed, self).setup()
+ super().setup()
self.add_copy_spec("/etc/named/")
self.add_copy_spec("/etc/sysconfig/named")
self.add_cmd_output("klist -ket /etc/named.keytab")
self.add_forbidden_path("/etc/named.keytab")
- return
class DebianNamed(Named, DebianPlugin, UbuntuPlugin):
@@ -78,9 +77,8 @@ class DebianNamed(Named, DebianPlugin, UbuntuPlugin):
"/etc/bind/named.conf.local")
def setup(self):
- super(DebianNamed, self).setup()
+ super().setup()
self.add_copy_spec("/etc/bind/")
- return
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/navicli.py b/sos/report/plugins/navicli.py
index 6e258568..16ceaf70 100644
--- a/sos/report/plugins/navicli.py
+++ b/sos/report/plugins/navicli.py
@@ -38,31 +38,31 @@ class Navicli(Plugin, RedHatPlugin):
"/etc/Navisphere/log/[a-z]*"
])
- def get_navicli_SP_info(self, SP_address):
+ def get_navicli_sp_info(self, sp_address):
""" EMC Navisphere Host Agent NAVICLI specific
information - CLARiiON - commands
"""
self.add_cmd_output([
- "navicli -h %s getall" % SP_address,
- "navicli -h %s getsptime -spa" % SP_address,
- "navicli -h %s getsptime -spb" % SP_address,
- "navicli -h %s getlog" % SP_address,
- "navicli -h %s getdisk" % SP_address,
- "navicli -h %s getcache" % SP_address,
- "navicli -h %s getlun" % SP_address,
+ "navicli -h %s getall" % sp_address,
+ "navicli -h %s getsptime -spa" % sp_address,
+ "navicli -h %s getsptime -spb" % sp_address,
+ "navicli -h %s getlog" % sp_address,
+ "navicli -h %s getdisk" % sp_address,
+ "navicli -h %s getcache" % sp_address,
+ "navicli -h %s getlun" % sp_address,
"navicli -h %s getlun -rg -type -default -owner -crus "
- "-capacity" % SP_address,
- "navicli -h %s lunmapinfo" % SP_address,
- "navicli -h %s getcrus" % SP_address,
- "navicli -h %s port -list -all" % SP_address,
- "navicli -h %s storagegroup -list" % SP_address,
- "navicli -h %s spportspeed -get" % SP_address
+ "-capacity" % sp_address,
+ "navicli -h %s lunmapinfo" % sp_address,
+ "navicli -h %s getcrus" % sp_address,
+ "navicli -h %s port -list -all" % sp_address,
+ "navicli -h %s storagegroup -list" % sp_address,
+ "navicli -h %s spportspeed -get" % sp_address
])
def setup(self):
self.get_navicli_config()
- for ip in set(self.get_option("ipaddrs").split()):
- if self.exec_cmd("navicli -h %s getsptime" % (ip))['status'] == 0:
- self.get_navicli_SP_info(ip)
+ for addr in set(self.get_option("ipaddrs").split()):
+ if self.exec_cmd(f"navicli -h {addr} getsptime")['status'] == 0:
+ self.get_navicli_sp_info(addr)
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/networking.py b/sos/report/plugins/networking.py
index 7ba57b0b..e0b3b962 100644
--- a/sos/report/plugins/networking.py
+++ b/sos/report/plugins/networking.py
@@ -45,11 +45,7 @@ class Networking(Plugin):
ethtool_shortopts = "acdgiklmPST"
def setup(self):
- super(Networking, self).setup()
- for opt in self.ethtool_shortopts:
- self.add_cmd_tags({
- 'ethtool -%s .*' % opt: 'ethool_%s' % opt
- })
+ super().setup()
self.add_file_tags({
'/proc/net/bonding/bond.*': 'bond',
@@ -57,20 +53,20 @@ class Networking(Plugin):
})
self.add_copy_spec([
- "/proc/net/",
- "/etc/nsswitch.conf",
- "/etc/yp.conf",
+ "/etc/dnsmasq*",
+ "/etc/host*",
"/etc/inetd.conf",
+ "/etc/iproute2",
+ "/etc/network*",
+ "/etc/nsswitch.conf",
+ "/etc/resolv.conf",
"/etc/xinetd.conf",
"/etc/xinetd.d",
- "/etc/host*",
- "/etc/resolv.conf",
- "/etc/network*",
- "/etc/dnsmasq*",
+ "/etc/yp.conf",
+ "/proc/net/",
"/sys/class/net/*/device/numa_node",
"/sys/class/net/*/flags",
"/sys/class/net/*/statistics/",
- "/etc/iproute2"
])
self.add_forbidden_path([
@@ -136,6 +132,39 @@ class Networking(Plugin):
macsec_pred = SoSPredicate(self, kmods=['macsec'])
self.add_cmd_output(ip_macsec_show_cmd, pred=macsec_pred, changes=True)
+ self.collect_ss_ip_ethtool_info()
+ self.collect_bridge_info()
+
+ def add_command_tags(self):
+ """ Command tags for ip/ethtool/netstat """
+ for opt in self.ethtool_shortopts:
+ self.add_cmd_tags({
+ 'ethtool -%s .*' % opt: 'ethool_%s' % opt
+ })
+
+ self.add_cmd_tags({
+ "ethtool [^-].*": "ethtool",
+ "ip -d address": "ip_addr",
+ "ip -s -s neigh show": "ip_neigh_show",
+ "ip -s -d link": "ip_s_link",
+ "netstat.*-neopa": "netstat",
+ "netstat.*-agn": "netstat_agn",
+ "netstat -s": "netstat_s"
+ })
+
+ def collect_bridge_info(self):
+ """ Collect information about bridges (some data already collected via
+ "ip .." commands)
+ """
+ self.add_cmd_output([
+ "bridge -s -s -d link show",
+ "bridge -s -s -d -t fdb show",
+ "bridge -s -s -d -t mdb show",
+ "bridge -d vlan show"
+ ])
+
+ def collect_ss_ip_ethtool_info(self):
+ """ Collect ss, ip and ethtool cmd outputs """
ss_cmd = "ss -peaonmi"
ss_pred = SoSPredicate(self, kmods=self.ss_kmods,
required={'kmods': 'all'})
@@ -166,15 +195,6 @@ class Networking(Plugin):
"interrupt device operation")
self.add_device_cmd(cmd, devices="ethernet")
- # Collect information about bridges (some data already collected via
- # "ip .." commands)
- self.add_cmd_output([
- "bridge -s -s -d link show",
- "bridge -s -s -d -t fdb show",
- "bridge -s -s -d -t mdb show",
- "bridge -d vlan show"
- ])
-
if self.get_option("traceroute"):
self.add_cmd_output("/bin/traceroute -n %s" % self.trace_host,
priority=100)
@@ -190,11 +210,11 @@ class Networking(Plugin):
# 'ip netns exec <foo> iptables-save' must be guarded by nf_tables
# kmod, if 'iptables -V' output contains 'nf_tables'
# analogously for ip6tables
- co = {'cmd': 'iptables -V', 'output': 'nf_tables'}
+ cout = {'cmd': 'iptables -V', 'output': 'nf_tables'}
co6 = {'cmd': 'ip6tables -V', 'output': 'nf_tables'}
iptables_with_nft = (SoSPredicate(self, kmods=['nf_tables'])
if self.test_predicate(self,
- pred=SoSPredicate(self, cmd_outputs=co))
+ pred=SoSPredicate(self, cmd_outputs=cout))
else None)
ip6tables_with_nft = (SoSPredicate(self, kmods=['nf_tables'])
if self.test_predicate(self,
@@ -245,22 +265,7 @@ class Networking(Plugin):
ns_cmd_prefix + "ethtool -S %(dev)s"
], devices=_devs['ethernet'], priority=50, subdir=_subdir)
- self.add_cmd_tags({
- "ethtool [^-].*": "ethtool",
- "ethtool -S.*": "ethtool_S",
- "ethtool -T.*": "ethtool_T",
- "ethtool -a.*": "ethtool_a",
- "ethtool -c.*": "ethtool_c",
- "ethtool -g.*": "ethtool_g",
- "ethtool -i.*": "ethtool_i",
- "ethtool -k.*": "ethtool_k",
- "ip -d address": "ip_addr",
- "ip -s -s neigh show": "ip_neigh_show",
- "ip -s -d link": "ip_s_link",
- "netstat.*-neopa": "netstat",
- "netstat.*-agn": "netstat_agn",
- "netstat -s": "netstat_s"
- })
+ self.add_command_tags()
class RedHatNetworking(Networking, RedHatPlugin):
@@ -273,11 +278,11 @@ class RedHatNetworking(Networking, RedHatPlugin):
# major version
if int(netstat_pkg['version'][0]) < 2:
self.ns_wide = "-T"
- except Exception:
+ except Exception: # pylint: disable=broad-except
# default to upstream option
pass
- super(RedHatNetworking, self).setup()
+ super().setup()
class UbuntuNetworking(Networking, UbuntuPlugin, DebianPlugin):
@@ -295,23 +300,19 @@ class UbuntuNetworking(Networking, UbuntuPlugin, DebianPlugin):
if self.policy.dist_version() in ubuntu_ss_kmods:
self.ss_kmods = ubuntu_ss_kmods[self.policy.dist_version()]
- super(UbuntuNetworking, self).setup()
+ super().setup()
self.add_copy_spec([
- "/etc/resolvconf",
+ "/etc/netplan/*.yaml",
"/etc/network/interfaces",
"/etc/network/interfaces.d",
"/etc/resolv.conf",
- "/run/netplan/*.yaml",
- "/etc/netplan/*.yaml",
+ "/etc/resolvconf",
"/lib/netplan/*.yaml",
+ "/run/netplan/*.yaml",
"/run/systemd/network"
])
- if self.get_option("traceroute"):
- self.add_cmd_output("/usr/sbin/traceroute -n %s" % self.trace_host,
- priority=100)
-
def postproc(self):
self.do_path_regex_sub(
diff --git a/sos/report/plugins/networkmanager.py b/sos/report/plugins/networkmanager.py
index 5d0dcd99..7773e19c 100644
--- a/sos/report/plugins/networkmanager.py
+++ b/sos/report/plugins/networkmanager.py
@@ -6,8 +6,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
import os
+from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class NetworkManager(Plugin, RedHatPlugin, UbuntuPlugin):
@@ -112,7 +112,7 @@ class NetworkManager(Plugin, RedHatPlugin, UbuntuPlugin):
})
def postproc(self):
- for root, dirs, files in os.walk(
+ for _, _, files in os.walk(
"/etc/NetworkManager/system-connections"):
for net_conf in files:
self.do_file_sub(
diff --git a/sos/report/plugins/nfsganesha.py b/sos/report/plugins/nfsganesha.py
index 6bdec5ae..14128a30 100644
--- a/sos/report/plugins/nfsganesha.py
+++ b/sos/report/plugins/nfsganesha.py
@@ -35,7 +35,5 @@ class NfsGanesha(Plugin, IndependentPlugin):
"org.ganesha.nfsd.exportmgr.ShowExports"
])
- return
-
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/npm.py b/sos/report/plugins/npm.py
index 78f80c91..5b373ab4 100644
--- a/sos/report/plugins/npm.py
+++ b/sos/report/plugins/npm.py
@@ -57,7 +57,4 @@ class NpmViaNodeJS(Npm):
# also in Fedora 24+ it is just nodejs, no npm package
packages = ('nodejs', )
-# TODO: in RHEL npm and nodejs is available via software collections
-# this should be handled separately
-
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/nscd.py b/sos/report/plugins/nscd.py
index c6f3c631..8f624284 100644
--- a/sos/report/plugins/nscd.py
+++ b/sos/report/plugins/nscd.py
@@ -23,10 +23,10 @@ class Nscd(Plugin, IndependentPlugin):
def setup(self):
self.add_copy_spec("/etc/nscd.conf")
- opt = self.file_grep(r"^\s*logfile", "/etc/nscd.conf")
- if (len(opt) > 0):
- for o in opt:
- f = o.split()
- self.add_copy_spec(f[1])
+ options = self.file_grep(r"^\s*logfile", "/etc/nscd.conf")
+ if len(options) > 0:
+ for opt in options:
+ fields = opt.split()
+ self.add_copy_spec(fields[1])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/ntp.py b/sos/report/plugins/ntp.py
index 35325ac2..8ffa7ecc 100644
--- a/sos/report/plugins/ntp.py
+++ b/sos/report/plugins/ntp.py
@@ -39,7 +39,7 @@ class Ntp(Plugin):
class RedHatNtp(Ntp, RedHatPlugin):
def setup(self):
- super(RedHatNtp, self).setup()
+ super().setup()
self.add_copy_spec("/etc/sysconfig/ntpd")
self.add_cmd_output("ntpstat")
@@ -47,7 +47,7 @@ class RedHatNtp(Ntp, RedHatPlugin):
class DebianNtp(Ntp, DebianPlugin, UbuntuPlugin):
def setup(self):
- super(DebianNtp, self).setup()
+ super().setup()
self.add_copy_spec('/etc/default/ntp')
diff --git a/sos/report/plugins/omnipath_client.py b/sos/report/plugins/omnipath_client.py
index ec7bf23d..9bb3fb13 100644
--- a/sos/report/plugins/omnipath_client.py
+++ b/sos/report/plugins/omnipath_client.py
@@ -14,8 +14,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
from os.path import join
+from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class OmnipathClient(Plugin, RedHatPlugin, UbuntuPlugin):
diff --git a/sos/report/plugins/omsa.py b/sos/report/plugins/omsa.py
index ddfc1435..621db230 100644
--- a/sos/report/plugins/omsa.py
+++ b/sos/report/plugins/omsa.py
@@ -9,7 +9,7 @@
from sos.report.plugins import Plugin, IndependentPlugin
-class omsa(Plugin, IndependentPlugin):
+class OMSA(Plugin, IndependentPlugin):
short_desc = 'Dell OpenManage Server Administrator (OMSA)'
diff --git a/sos/report/plugins/openshift.py b/sos/report/plugins/openshift.py
index a41ab62b..6b14babd 100644
--- a/sos/report/plugins/openshift.py
+++ b/sos/report/plugins/openshift.py
@@ -6,10 +6,10 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
from fnmatch import translate
import os
import re
+from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
class Openshift(Plugin, RedHatPlugin):
@@ -65,6 +65,8 @@ class Openshift(Plugin, RedHatPlugin):
'kube-apiserver-certs/secrets/node-kubeconfigs/localhost.kubeconfig'
)
+ oc_cmd = "oc get "
+
option_list = [
PluginOpt('token', default=None, val_type=str,
desc='admin token to allow API queries'),
@@ -154,7 +156,7 @@ class Openshift(Plugin, RedHatPlugin):
"""
if self.get_option('only-namespaces'):
- return [n for n in self.get_option('only-namespaces').split(':')]
+ return list(self.get_option('only-namespaces').split(':'))
collect_regexes = [
'openshift.*',
@@ -175,21 +177,21 @@ class Openshift(Plugin, RedHatPlugin):
:param nsps list: Namespace names from oc output
"""
- def _match_namespace(namespace):
+ def _match_namespace(namespace, regexes):
"""Match a particular namespace for inclusion (or not) in the
collection phases
:param namespace str: The name of a namespace
"""
- for regex in self.collect_regexes:
+ for regex in regexes:
if re.match(regex, namespace):
return True
return False
- self.collect_regexes = self._setup_namespace_regexes()
+ regexes = self._setup_namespace_regexes()
- return list(set([n for n in nsps if _match_namespace(n)]))
+ return list({n for n in nsps if _match_namespace(n, regexes)})
def setup(self):
"""The setup() phase of this plugin will iterate through all default
@@ -235,7 +237,6 @@ class Openshift(Plugin, RedHatPlugin):
'the setup and collection phases'
)
- self.oc_cmd = "oc get "
oc_nsps = []
# get 'global' or cluster-level information
diff --git a/sos/report/plugins/openssl.py b/sos/report/plugins/openssl.py
index 1003f99d..c1f8e93f 100644
--- a/sos/report/plugins/openssl.py
+++ b/sos/report/plugins/openssl.py
@@ -41,7 +41,7 @@ class RedHatOpenSSL(OpenSSL, RedHatPlugin):
files = ('/etc/pki/tls/openssl.cnf',)
def setup(self):
- super(RedHatOpenSSL, self).setup()
+ super().setup()
self.add_copy_spec("/etc/pki/tls/openssl.cnf")
@@ -50,7 +50,7 @@ class DebianOpenSSL(OpenSSL, DebianPlugin, UbuntuPlugin):
files = ('/etc/ssl/openssl.cnf',)
def setup(self):
- super(DebianOpenSSL, self).setup()
+ super().setup()
self.add_copy_spec("/etc/ssl/openssl.cnf")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/openstack_aodh.py b/sos/report/plugins/openstack_aodh.py
index a3cb0f50..b50a4bd4 100644
--- a/sos/report/plugins/openstack_aodh.py
+++ b/sos/report/plugins/openstack_aodh.py
@@ -20,6 +20,7 @@ class OpenStackAodh(Plugin):
profiles = ('openstack', 'openstack_controller')
var_puppet_gen = "/var/lib/config-data/puppet-generated/aodh"
+ apachepkg = None
def setup(self):
self.add_copy_spec([
@@ -62,6 +63,7 @@ class OpenStackAodh(Plugin):
])
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub(
"/etc/aodh/aodh.conf",
regexp, subst
@@ -110,7 +112,7 @@ class RedHatOpenStackAodh(OpenStackAodh, RedHatPlugin):
packages = ('openstack-selinux',)
def setup(self):
- super(RedHatOpenStackAodh, self).setup()
+ super().setup()
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/containers/httpd/aodh-api/*",
diff --git a/sos/report/plugins/openstack_ceilometer.py b/sos/report/plugins/openstack_ceilometer.py
index 7b313f54..2e290cd2 100644
--- a/sos/report/plugins/openstack_ceilometer.py
+++ b/sos/report/plugins/openstack_ceilometer.py
@@ -43,6 +43,7 @@ class OpenStackCeilometer(Plugin):
})
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub("/etc/ceilometer/*", regexp, subst)
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/ceilometer/*",
@@ -89,7 +90,7 @@ class RedHatCeilometer(OpenStackCeilometer, RedHatPlugin):
packages = ('openstack-selinux',)
def setup(self):
- super(RedHatCeilometer, self).setup()
+ super().setup()
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/containers/ceilometer/*",
diff --git a/sos/report/plugins/openstack_cinder.py b/sos/report/plugins/openstack_cinder.py
index 99836ade..9935c87f 100644
--- a/sos/report/plugins/openstack_cinder.py
+++ b/sos/report/plugins/openstack_cinder.py
@@ -12,8 +12,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
+from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackCinder(Plugin):
@@ -24,6 +24,7 @@ class OpenStackCinder(Plugin):
containers = ('.*cinder_api',)
var_puppet_gen = "/var/lib/config-data/puppet-generated/cinder"
+ apachepkg = None
def setup(self):
self.add_forbidden_path('/etc/cinder/volumes')
@@ -133,6 +134,7 @@ class OpenStackCinder(Plugin):
])
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub("/etc/cinder/*", regexp, subst)
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/cinder/*",
@@ -187,7 +189,7 @@ class RedHatCinder(OpenStackCinder, RedHatPlugin):
packages = ('openstack-selinux',)
def setup(self):
- super(RedHatCinder, self).setup()
+ super().setup()
self.add_copy_spec(["/etc/sudoers.d/cinder"])
diff --git a/sos/report/plugins/openstack_database.py b/sos/report/plugins/openstack_database.py
index e9f84cf8..14bb1c32 100644
--- a/sos/report/plugins/openstack_database.py
+++ b/sos/report/plugins/openstack_database.py
@@ -61,16 +61,16 @@ class OpenStackDatabase(Plugin):
sizelimit=0, container=cname)
def get_mysql_db_string(self, container=None):
-
+ """ Get mysql DB command to be dumped """
if self.get_option('dumpall'):
return '--all-databases'
collect = []
dbs = self.exec_cmd('mysql -e "show databases;"', container=container)
- for db in dbs['output'].splitlines():
- if any([re.match(db, reg) for reg in self.databases]):
- collect.append(db)
+ for database in dbs['output'].splitlines():
+ if any(re.match(database, reg) for reg in self.databases):
+ collect.append(database)
return '-B ' + ' '.join(d for d in collect)
diff --git a/sos/report/plugins/openstack_edpm.py b/sos/report/plugins/openstack_edpm.py
index 2c4a346b..d95b326e 100644
--- a/sos/report/plugins/openstack_edpm.py
+++ b/sos/report/plugins/openstack_edpm.py
@@ -18,6 +18,7 @@ class OpenStackEDPM(Plugin, RedHatPlugin):
plugin_name = 'openstack_edpm'
profiles = ('openstack', 'openstack_edpm')
services = ('edpm-container-shutdown')
+ edpm_log_paths = []
def setup(self):
# Notes: recursion is max 2 for edpm-config
diff --git a/sos/report/plugins/openstack_glance.py b/sos/report/plugins/openstack_glance.py
index 987f63d6..560e94a3 100644
--- a/sos/report/plugins/openstack_glance.py
+++ b/sos/report/plugins/openstack_glance.py
@@ -12,8 +12,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
+from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackGlance(Plugin):
@@ -89,6 +89,7 @@ class OpenStackGlance(Plugin):
})
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub("/etc/glance/*", regexp, subst)
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/glance/*",
diff --git a/sos/report/plugins/openstack_gnocchi.py b/sos/report/plugins/openstack_gnocchi.py
index df8122ea..f69ef432 100644
--- a/sos/report/plugins/openstack_gnocchi.py
+++ b/sos/report/plugins/openstack_gnocchi.py
@@ -19,6 +19,7 @@ class Gnocchi(Plugin):
plugin_name = "openstack_gnocchi"
profiles = ('openstack', 'openstack_controller')
+ apachepkg = None
def setup(self):
self.add_copy_spec([
@@ -76,7 +77,7 @@ class RedHatGnocchi(Gnocchi, RedHatPlugin):
)
def setup(self):
- super(RedHatGnocchi, self).setup()
+ super().setup()
self.add_copy_spec([
self.var_puppet_gen + "/etc/gnocchi/*",
self.var_puppet_gen + "/etc/httpd/conf/*",
@@ -86,7 +87,7 @@ class RedHatGnocchi(Gnocchi, RedHatPlugin):
])
def postproc(self):
- super(RedHatGnocchi, self).postproc()
+ super().postproc()
self.do_file_sub(
self.var_puppet_gen + "/etc/gnocchi/"
"gnocchi.conf",
diff --git a/sos/report/plugins/openstack_heat.py b/sos/report/plugins/openstack_heat.py
index 83849d00..9074e25a 100644
--- a/sos/report/plugins/openstack_heat.py
+++ b/sos/report/plugins/openstack_heat.py
@@ -9,8 +9,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
+from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackHeat(Plugin):
@@ -98,6 +98,7 @@ class OpenStackHeat(Plugin):
})
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub(
"/etc/heat/*",
regexp, subst)
diff --git a/sos/report/plugins/openstack_horizon.py b/sos/report/plugins/openstack_horizon.py
index f7952df9..5405acdd 100644
--- a/sos/report/plugins/openstack_horizon.py
+++ b/sos/report/plugins/openstack_horizon.py
@@ -67,7 +67,7 @@ class DebianHorizon(OpenStackHorizon, DebianPlugin):
)
def setup(self):
- super(DebianHorizon, self).setup()
+ super().setup()
self.add_copy_spec("/etc/apache2/sites-available/")
@@ -81,7 +81,7 @@ class UbuntuHorizon(OpenStackHorizon, UbuntuPlugin):
)
def setup(self):
- super(UbuntuHorizon, self).setup()
+ super().setup()
self.add_copy_spec("/etc/apache2/conf.d/openstack-dashboard.conf")
@@ -90,7 +90,7 @@ class RedHatHorizon(OpenStackHorizon, RedHatPlugin):
packages = ('openstack-selinux',)
def setup(self):
- super(RedHatHorizon, self).setup()
+ super().setup()
self.add_copy_spec("/etc/httpd/conf.d/openstack-dashboard.conf")
if self.get_option("all_logs"):
self.add_copy_spec("/var/log/httpd/horizon*")
diff --git a/sos/report/plugins/openstack_instack.py b/sos/report/plugins/openstack_instack.py
index 1ca70fb0..e9e4e093 100644
--- a/sos/report/plugins/openstack_instack.py
+++ b/sos/report/plugins/openstack_instack.py
@@ -9,10 +9,10 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin
import configparser
import os
import re
+from sos.report.plugins import Plugin, RedHatPlugin
NON_CONTAINERIZED_DEPLOY = [
@@ -61,19 +61,7 @@ class OpenStackInstack(Plugin):
vars_any = [p in os.environ for p in [
'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
- # capture yaml files to define overrides
- uc_config = configparser.ConfigParser()
- try:
- uc_config.read(UNDERCLOUD_CONF_PATH)
- override_opts = ['hieradata_override', 'net_config_override']
- for opt in override_opts:
- p = uc_config.get(opt)
- if p:
- if not os.path.isabs(p):
- p = self.path_join('/home/stack', p)
- self.add_copy_spec(p)
- except Exception:
- pass
+ self.capture_undercloud_yamls()
if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
@@ -112,6 +100,21 @@ class OpenStackInstack(Plugin):
self.add_cmd_output("openstack object save "
"tripleo-ui-logs tripleo-ui.logs --file -")
+ def capture_undercloud_yamls(self):
+ """ capture yaml files to define overrides """
+ uc_config = configparser.ConfigParser()
+ try:
+ uc_config.read(UNDERCLOUD_CONF_PATH)
+ override_opts = ['hieradata_override', 'net_config_override']
+ for opt in override_opts:
+ path = uc_config.get('DEFAULT', opt)
+ if path:
+ if not os.path.isabs(path):
+ path = self.path_join('/home/stack', path)
+ self.add_copy_spec(path)
+ except Exception: # pylint: disable=broad-except
+ pass
+
def postproc(self):
# do_file_sub is case insensitive, so protected_keys can be lowercase
# only
@@ -151,7 +154,4 @@ class RedHatRDOManager(OpenStackInstack, RedHatPlugin):
packages = ('openstack-selinux',)
- def setup(self):
- super(RedHatRDOManager, self).setup()
-
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/openstack_ironic.py b/sos/report/plugins/openstack_ironic.py
index 05985e53..ef2df232 100644
--- a/sos/report/plugins/openstack_ironic.py
+++ b/sos/report/plugins/openstack_ironic.py
@@ -9,8 +9,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
+from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackIronic(Plugin):
@@ -22,6 +22,8 @@ class OpenStackIronic(Plugin):
var_puppet_gen = "/var/lib/config-data/puppet-generated/ironic"
ins_puppet_gen = var_puppet_gen + "_inspector"
+ conf_list = []
+ osc_available = False
def setup(self):
@@ -133,6 +135,7 @@ class OpenStackIronic(Plugin):
self.add_cmd_output("openstack baremetal port group list --long")
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
for conf in self.conf_list:
self.do_path_regex_sub(conf, regexp, subst)
@@ -159,9 +162,6 @@ class DebianIronic(OpenStackIronic, DebianPlugin, UbuntuPlugin):
packages = ('ironic-api', 'ironic-common', 'ironic-conductor')
- def setup(self):
- super(DebianIronic, self).setup()
-
class RedHatIronic(OpenStackIronic, RedHatPlugin):
@@ -173,6 +173,7 @@ class RedHatIronic(OpenStackIronic, RedHatPlugin):
]
def collect_introspection_data(self):
+ """ Capture baremetal introspection data """
uuids_result = self.collect_cmd_output(
'openstack baremetal node list -f value -c UUID'
)
@@ -188,11 +189,11 @@ class RedHatIronic(OpenStackIronic, RedHatPlugin):
'data save %s' % uuid)
def setup(self):
- super(RedHatIronic, self).setup()
+ super().setup()
# ironic-discoverd was renamed to ironic-inspector in Liberty
# is the optional ironic-discoverd service installed?
- if any([self.is_installed(p) for p in self.discoverd_packages]):
+ if any(self.is_installed(p) for p in self.discoverd_packages):
self.conf_list.append('/etc/ironic-discoverd/*')
self.add_copy_spec('/etc/ironic-discoverd/')
self.add_copy_spec('/var/lib/ironic-discoverd/')
diff --git a/sos/report/plugins/openstack_keystone.py b/sos/report/plugins/openstack_keystone.py
index 3dbb182e..d7a50bd2 100644
--- a/sos/report/plugins/openstack_keystone.py
+++ b/sos/report/plugins/openstack_keystone.py
@@ -9,9 +9,9 @@
#
# See the LICENSE file in the source distribution for further information.
+import os
from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin,
UbuntuPlugin, PluginOpt)
-import os
class OpenStackKeystone(Plugin):
@@ -25,6 +25,8 @@ class OpenStackKeystone(Plugin):
desc='do not collect keystone passwords')
]
var_puppet_gen = "/var/lib/config-data/puppet-generated/keystone"
+ apachepkg = None
+ domain_config_dir = ""
def setup(self):
self.add_copy_spec([
@@ -59,7 +61,7 @@ class OpenStackKeystone(Plugin):
"identity domain_config_dir")
self.domain_config_dir = exec_out['output']
if exec_out['status'] != 0 or \
- not (self.path_isdir(self.domain_config_dir)):
+ not self.path_isdir(self.domain_config_dir):
self.domain_config_dir = "/etc/keystone/domains"
self.add_copy_spec(self.domain_config_dir)
@@ -83,6 +85,7 @@ class OpenStackKeystone(Plugin):
})
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub("/etc/keystone/*", regexp, subst)
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/keystone/*",
diff --git a/sos/report/plugins/openstack_manila.py b/sos/report/plugins/openstack_manila.py
index 4c03e50f..2bac0acc 100644
--- a/sos/report/plugins/openstack_manila.py
+++ b/sos/report/plugins/openstack_manila.py
@@ -51,6 +51,7 @@ class OpenStackManila(Plugin):
})
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub("/etc/manila/*", regexp, subst)
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/manila/*",
@@ -87,7 +88,7 @@ class DebianManila(OpenStackManila, DebianPlugin, UbuntuPlugin):
)
def setup(self):
- super(DebianManila, self).setup()
+ super().setup()
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/apache2/manila*",
@@ -104,7 +105,7 @@ class RedHatManila(OpenStackManila, RedHatPlugin):
packages = ('openstack-selinux',)
def setup(self):
- super(RedHatManila, self).setup()
+ super().setup()
self.add_copy_spec("/etc/sudoers.d/manila")
if self.get_option("all_logs"):
diff --git a/sos/report/plugins/openstack_neutron.py b/sos/report/plugins/openstack_neutron.py
index dd8328e9..ae211567 100644
--- a/sos/report/plugins/openstack_neutron.py
+++ b/sos/report/plugins/openstack_neutron.py
@@ -9,8 +9,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
+from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackNeutron(Plugin):
@@ -82,6 +82,7 @@ class OpenStackNeutron(Plugin):
})
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub("/etc/neutron/*", regexp, subst)
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/neutron/*",
@@ -131,7 +132,7 @@ class DebianNeutron(OpenStackNeutron, DebianPlugin, UbuntuPlugin):
return self.is_installed("neutron-common")
def setup(self):
- super(DebianNeutron, self).setup()
+ super().setup()
self.add_copy_spec("/etc/sudoers.d/neutron_sudoers")
@@ -141,7 +142,7 @@ class RedHatNeutron(OpenStackNeutron, RedHatPlugin):
var_ansible_gen = "/var/lib/config-data/ansible-generated/"
def setup(self):
- super(RedHatNeutron, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/sudoers.d/neutron-rootwrap",
self.var_ansible_gen + "/neutron-dhcp-agent/",
diff --git a/sos/report/plugins/openstack_nova.py b/sos/report/plugins/openstack_nova.py
index d1ae49ae..30e5ed08 100644
--- a/sos/report/plugins/openstack_nova.py
+++ b/sos/report/plugins/openstack_nova.py
@@ -13,9 +13,9 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
import re
+from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackNova(Plugin):
@@ -28,6 +28,7 @@ class OpenStackNova(Plugin):
var_puppet_gen = "/var/lib/config-data/puppet-generated/nova"
service_name = "openstack-nova-api.service"
+ apachepkg = None
def setup(self):
@@ -114,8 +115,8 @@ class OpenStackNova(Plugin):
f"/var/log/{self.apachepkg}*/placement*.log",
])
- pp = ['', '_libvirt', '_metadata', '_placement']
- sp = [
+ npaths = ['', '_libvirt', '_metadata', '_placement']
+ syspaths = [
'/etc/nova/',
'/etc/my.cnf.d/tripleo.cnf',
'/etc/httpd/conf/',
@@ -133,16 +134,17 @@ class OpenStackNova(Plugin):
self.var_puppet_gen + "_libvirt/var/lib/nova/.ssh/config"
] + list(
filter(re.compile('^((?!libvirt.+httpd).)*$').match,
- ['%s%s%s' % (
- self.var_puppet_gen, p, s) for p in pp for s in sp
+ ['%s%s%s' % (self.var_puppet_gen, p, s)
+ for p in npaths for s in syspaths
]))
self.add_copy_spec(specs)
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub("/etc/nova/*", regexp, subst)
- for p in ['', '_libvirt', '_metadata', '_placement']:
+ for npath in ['', '_libvirt', '_metadata', '_placement']:
self.do_path_regex_sub(
- "%s%s/etc/nova/*" % (self.var_puppet_gen, p),
+ "%s%s/etc/nova/*" % (self.var_puppet_gen, npath),
regexp, subst)
def postproc(self):
@@ -198,7 +200,7 @@ class DebianNova(OpenStackNova, DebianPlugin, UbuntuPlugin):
service_name = "nova-api.service"
def setup(self):
- super(DebianNova, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/sudoers.d/nova_sudoers",
"/usr/share/polkit-1/rules.d/60-libvirt.rules",
@@ -212,7 +214,7 @@ class RedHatNova(OpenStackNova, RedHatPlugin):
packages = ('openstack-selinux',)
def setup(self):
- super(RedHatNova, self).setup()
+ super().setup()
self.add_copy_spec([
"/etc/logrotate.d/openstack-nova",
"/etc/polkit-1/localauthority/50-local.d/50-nova.pkla",
diff --git a/sos/report/plugins/openstack_novajoin.py b/sos/report/plugins/openstack_novajoin.py
index 83aa8e0c..bc73c9a5 100644
--- a/sos/report/plugins/openstack_novajoin.py
+++ b/sos/report/plugins/openstack_novajoin.py
@@ -34,7 +34,5 @@ class RedHatNovajoin(OpenStackNovajoin, RedHatPlugin):
packages = ('python-novajoin',)
- def setup(self):
- super(RedHatNovajoin, self).setup()
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/openstack_octavia.py b/sos/report/plugins/openstack_octavia.py
index 75657d31..b2706521 100644
--- a/sos/report/plugins/openstack_octavia.py
+++ b/sos/report/plugins/openstack_octavia.py
@@ -104,11 +104,11 @@ class OpenStackOctavia(Plugin):
cmd = "openstack loadbalancer provider list -f value -c name"
ret = self.exec_cmd(cmd)
if ret['status'] == 0:
- for p in ret['output'].splitlines():
- p = p.split()[0]
+ for provider in ret['output'].splitlines():
+ provider = provider.split()[0]
self.add_cmd_output(
"openstack loadbalancer provider capability list"
- " %s" % p,
+ " %s" % provider,
subdir='provider_capability')
def postproc(self):
@@ -135,7 +135,7 @@ class DebianOctavia(OpenStackOctavia, DebianPlugin, UbuntuPlugin):
)
def setup(self):
- super(DebianOctavia, self).setup()
+ super().setup()
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/apache2/octavia*",
diff --git a/sos/report/plugins/openstack_placement.py b/sos/report/plugins/openstack_placement.py
index 9d5fa1b2..2dcb9463 100644
--- a/sos/report/plugins/openstack_placement.py
+++ b/sos/report/plugins/openstack_placement.py
@@ -8,8 +8,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
+from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackPlacement(Plugin):
@@ -21,6 +21,7 @@ class OpenStackPlacement(Plugin):
var_puppet_gen = "/var/lib/config-data/puppet-generated/placement"
service_name = 'openstack-placement-api'
+ apachepkg = None
def setup(self):
@@ -96,6 +97,7 @@ class OpenStackPlacement(Plugin):
])
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub("/etc/placement/*", regexp, subst)
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/placement/*",
diff --git a/sos/report/plugins/openstack_sahara.py b/sos/report/plugins/openstack_sahara.py
index 0a7fcf04..1a454a7f 100644
--- a/sos/report/plugins/openstack_sahara.py
+++ b/sos/report/plugins/openstack_sahara.py
@@ -37,6 +37,7 @@ class OpenStackSahara(Plugin):
])
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub("/etc/sahara/*", regexp, subst)
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/sahara/*",
@@ -73,9 +74,6 @@ class DebianSahara(OpenStackSahara, DebianPlugin, UbuntuPlugin):
'python3-sahara',
)
- def setup(self):
- super(DebianSahara, self).setup()
-
class RedHatSahara(OpenStackSahara, RedHatPlugin):
@@ -83,7 +81,7 @@ class RedHatSahara(OpenStackSahara, RedHatPlugin):
packages = ('openstack-selinux',)
def setup(self):
- super(RedHatSahara, self).setup()
+ super().setup()
self.add_copy_spec("/etc/sudoers.d/sahara*")
diff --git a/sos/report/plugins/openstack_swift.py b/sos/report/plugins/openstack_swift.py
index 4f4324c2..f1da8763 100644
--- a/sos/report/plugins/openstack_swift.py
+++ b/sos/report/plugins/openstack_swift.py
@@ -46,6 +46,7 @@ class OpenStackSwift(Plugin):
})
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub(r"/etc/swift/.*\.conf.*", regexp, subst)
self.do_path_regex_sub(
self.var_puppet_gen + r"/swift/etc/swift/.*\.conf.*",
diff --git a/sos/report/plugins/openstack_tripleo.py b/sos/report/plugins/openstack_tripleo.py
index d356a6b6..e53b21f1 100644
--- a/sos/report/plugins/openstack_tripleo.py
+++ b/sos/report/plugins/openstack_tripleo.py
@@ -18,6 +18,7 @@ class OpenStackTripleO(Plugin, IndependentPlugin):
plugin_name = 'openstack_tripleo'
profiles = ('openstack', 'openstack_controller', 'openstack_compute')
packages = ('openstack-selinux',)
+ tripleo_log_paths = []
def setup(self):
# Notes: recursion is max 2 for container-puppet and tripleo-config
diff --git a/sos/report/plugins/openstack_trove.py b/sos/report/plugins/openstack_trove.py
index de8fe77c..b54156c0 100644
--- a/sos/report/plugins/openstack_trove.py
+++ b/sos/report/plugins/openstack_trove.py
@@ -36,6 +36,7 @@ class OpenStackTrove(Plugin):
])
def apply_regex_sub(self, regexp, subst):
+ """ Apply regex substitution """
self.do_path_regex_sub("/etc/trove/*", regexp, subst)
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/trove/*",
@@ -71,15 +72,9 @@ class DebianTrove(OpenStackTrove, DebianPlugin, UbuntuPlugin):
'python3-trove',
)
- def setup(self):
- super(DebianTrove, self).setup()
-
class RedHatTrove(OpenStackTrove, RedHatPlugin):
packages = ('openstack-selinux',)
- def setup(self):
- super(RedHatTrove, self).setup()
-
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/opensvc.py b/sos/report/plugins/opensvc.py
index 57edfe91..7c65883f 100644
--- a/sos/report/plugins/opensvc.py
+++ b/sos/report/plugins/opensvc.py
@@ -17,6 +17,7 @@ class Opensvc(Plugin, IndependentPlugin):
packages = ('opensvc',)
def get_status(self, kind):
+ """ Get the status of opensvc management service """
getobjs = self.collect_cmd_output("om %s ls --color=no" % kind)
dirname = kind + '_status'
if getobjs['status'] == 0:
diff --git a/sos/report/plugins/openvswitch.py b/sos/report/plugins/openvswitch.py
index 57d5a3b0..015dbf71 100644
--- a/sos/report/plugins/openvswitch.py
+++ b/sos/report/plugins/openvswitch.py
@@ -8,11 +8,9 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-
from os import environ
-
import re
+from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenVSwitch(Plugin):
@@ -20,6 +18,9 @@ class OpenVSwitch(Plugin):
short_desc = 'OpenVSwitch networking'
plugin_name = "openvswitch"
profiles = ('network', 'virt')
+ actl = "ovs-appctl"
+ check_dpdk = False
+ check_6wind = False
def setup(self):
@@ -32,33 +33,10 @@ class OpenVSwitch(Plugin):
dpdk_enabled = self.collect_cmd_output(
"ovs-vsctl -t 5 get Open_vSwitch . other_config:dpdk-init")
- check_dpdk = (dpdk_enabled["status"] == 0 and
- dpdk_enabled["output"].startswith('"true"'))
- check_6wind = any([self.is_installed(p) for p in
- ['6windgate-fp', 'nuage-openvswitch']])
- actl = "ovs-appctl"
-
- files_6wind = [
- "/etc/systemd/system/multi-user.target.wants/openvswitch.service",
- "/etc/sysctl.d/60-6wind-system-auto-reboot.conf",
- "/etc/openvswitch/system-id.conf",
- "/etc/openvswitch/*.db",
- "/etc/ld.so.conf.d/linux-fp-sync-fptun.conf",
- "/etc/NetworkManager/conf.d/fpn0.conf",
- "/etc/default/openvswitch",
- "/etc/logrotate.d/openvswitch",
- "/etc/linux-fp-sync.env",
- "/etc/fp-daemons.env",
- "/etc/fp-vdev.ini",
- "/etc/fpm.env",
- "/etc/6WINDGate/fp.config",
- "/etc/6WINDGate/fpnsdk.config",
- "/etc/dms.d/fp-dms.conf",
- "/etc/dms.d/fpmd-dms.conf",
- "/etc/dms.d/fpsd-dms.conf",
- "/etc/fast-path.env",
- "/etc/fps-fp.env",
- ]
+ self.check_dpdk = (dpdk_enabled["status"] == 0 and
+ dpdk_enabled["output"].startswith('"true"'))
+ self.check_6wind = any(self.is_installed(p) for p in
+ ['6windgate-fp', 'nuage-openvswitch'])
if environ.get('OVS_LOGDIR'):
log_dirs.append(environ.get('OVS_LOGDIR'))
@@ -179,8 +157,36 @@ class OpenVSwitch(Plugin):
self.add_journal(units="ovsdb-server")
self.add_journal(units="ovs-configuration")
self.add_journal(units="openvswitch-ipsec")
+ self.collect_ovs_info()
+ self.collect_datapath()
+ self.collect_ovs_bridge_info()
+
+ def collect_ovs_info(self):
+ """ Collect output of OVS commands """
- if check_6wind:
+ files_6wind = [
+ "/etc/systemd/system/multi-user.target.wants/openvswitch.service",
+ "/etc/sysctl.d/60-6wind-system-auto-reboot.conf",
+ "/etc/openvswitch/system-id.conf",
+ "/etc/openvswitch/*.db",
+ "/etc/ld.so.conf.d/linux-fp-sync-fptun.conf",
+ "/etc/NetworkManager/conf.d/fpn0.conf",
+ "/etc/default/openvswitch",
+ "/etc/logrotate.d/openvswitch",
+ "/etc/linux-fp-sync.env",
+ "/etc/fp-daemons.env",
+ "/etc/fp-vdev.ini",
+ "/etc/fpm.env",
+ "/etc/6WINDGate/fp.config",
+ "/etc/6WINDGate/fpnsdk.config",
+ "/etc/dms.d/fp-dms.conf",
+ "/etc/dms.d/fpmd-dms.conf",
+ "/etc/dms.d/fpsd-dms.conf",
+ "/etc/fast-path.env",
+ "/etc/fps-fp.env",
+ ]
+
+ if self.check_6wind:
self.add_copy_spec(files_6wind)
self.add_cmd_output([
# Various fast-path stats
@@ -217,172 +223,181 @@ class OpenVSwitch(Plugin):
port_list = self.collect_cmd_output("fp-cli fp-vswitch-ports")
if port_list['status'] == 0:
for port in port_list['output'].splitlines():
- m = re.match(r'^([\d]+):[\s]+([^\s]+)', port)
- if m:
- port_name = m.group(2)
+ mport = re.match(r'^([\d]+):[\s]+([^\s]+)', port)
+ if mport:
+ port_name = mport.group(2)
self.add_cmd_output([
"fp-cli dpdk-cp-filter-budget %s" % port_name,
])
- # Gather the datapath information for each datapath
+ def collect_datapath(self):
+ """ Gather the datapath information for each datapath """
dp_list_result = self.collect_cmd_output('ovs-appctl dpctl/dump-dps')
if dp_list_result['status'] == 0:
- for dp in dp_list_result['output'].splitlines():
+ for dps in dp_list_result['output'].splitlines():
self.add_cmd_output([
- "%s dpctl/show -s %s" % (actl, dp),
- "%s dpctl/dump-flows -m %s" % (actl, dp),
- "%s dpctl/dump-conntrack -m %s" % (actl, dp),
- "%s dpctl/ct-stats-show -m %s" % (actl, dp),
- "%s dpctl/ipf-get-status %s" % (actl, dp),
+ "%s dpctl/show -s %s" % (self.actl, dps),
+ "%s dpctl/dump-flows -m %s" % (self.actl, dps),
+ "%s dpctl/dump-conntrack -m %s" % (self.actl, dps),
+ "%s dpctl/ct-stats-show -m %s" % (self.actl, dps),
+ "%s dpctl/ipf-get-status %s" % (self.actl, dps),
])
- # Gather additional output for each OVS bridge on the host.
+ def collect_ovs_bridge_info(self):
+ """ Gather additional output for each OVS bridge on the host. """
+
br_list_result = self.collect_cmd_output("ovs-vsctl -t 5 list-br")
- ofp_ver_result = self.collect_cmd_output("ovs-ofctl -t 5 --version")
- if br_list_result['status'] == 0:
- for br in br_list_result['output'].splitlines():
+ if br_list_result['status'] != 0:
+ return
+
+ for bri in br_list_result['output'].splitlines():
+ self.add_cmd_output([
+ "%s bridge/dump-flows --offload-stats %s" % (self.actl, bri),
+ "%s dpif/show-dp-features %s" % (self.actl, bri),
+ "%s fdb/show %s" % (self.actl, bri),
+ "%s fdb/stats-show %s" % (self.actl, bri),
+ "%s mdb/show %s" % (self.actl, bri),
+ "ovs-ofctl dump-flows %s" % bri,
+ "ovs-ofctl dump-ports-desc %s" % bri,
+ "ovs-ofctl dump-ports %s" % bri,
+ "ovs-ofctl queue-get-config %s" % bri,
+ "ovs-ofctl queue-stats %s" % bri,
+ "ovs-ofctl show %s" % bri,
+ "ovs-ofctl dump-groups %s" % bri,
+ ])
+
+ self.get_flow_versions(bri)
+
+ self.get_port_list(bri)
+
+ if self.check_dpdk:
+ iface_list_result = self.exec_cmd(
+ "ovs-vsctl -t 5 list-ifaces %s" % bri
+ )
+ if iface_list_result['status'] == 0:
+ for iface in iface_list_result['output'].splitlines():
+ self.add_cmd_output(
+ "ovs-appctl netdev-dpdk/get-mempool-info %s" %
+ iface)
+ if self.check_6wind:
self.add_cmd_output([
- "%s bridge/dump-flows --offload-stats %s" % (actl, br),
- "%s dpif/show-dp-features %s" % (actl, br),
- "%s fdb/show %s" % (actl, br),
- "%s fdb/stats-show %s" % (actl, br),
- "%s mdb/show %s" % (actl, br),
- "ovs-ofctl dump-flows %s" % br,
- "ovs-ofctl dump-ports-desc %s" % br,
- "ovs-ofctl dump-ports %s" % br,
- "ovs-ofctl queue-get-config %s" % br,
- "ovs-ofctl queue-stats %s" % br,
- "ovs-ofctl show %s" % br,
- "ovs-ofctl dump-groups %s" % br,
+ "%s evpn/vip-list-show %s" % (self.actl, bri),
+ "%s bridge/dump-conntracks-summary %s" % (self.actl, bri),
+ "%s bridge/acl-table ingress/egress %s" % (self.actl, bri),
+ "%s bridge/acl-table %s" % (self.actl, bri),
+ "%s ofproto/show %s" % (self.actl, bri),
])
- # Flow protocols currently supported
- flow_versions = [
- "OpenFlow10",
- "OpenFlow11",
- "OpenFlow12",
- "OpenFlow13",
- "OpenFlow14",
- "OpenFlow15"
- ]
-
- # Flow protocol hex identifiers
- ofp_versions = {
- 0x01: "OpenFlow10",
- 0x02: "OpenFlow11",
- 0x03: "OpenFlow12",
- 0x04: "OpenFlow13",
- 0x05: "OpenFlow14",
- 0x06: "OpenFlow15",
- }
-
- # List protocols currently in use, if any
- ovs_list_bridge_cmd = "ovs-vsctl -t 5 list bridge %s" % br
- br_info = self.collect_cmd_output(ovs_list_bridge_cmd)
-
- br_protos = []
- for line in br_info['output'].splitlines():
- if "protocols" in line:
- br_protos_ln = line[line.find("[")+1:line.find("]")]
- br_protos = br_protos_ln.replace('"', '').split(", ")
-
- # If 'list bridge' yeilded no protocols, use the range of
- # protocols enabled by default on this version of ovs.
- if br_protos == [''] and ofp_ver_result['output']:
- ofp_version_range = ofp_ver_result['output'].splitlines()
- ver_range = []
-
- for line in ofp_version_range:
- if "OpenFlow versions" in line:
- v = line.split("OpenFlow versions ")[1].split(":")
- ver_range = range(int(v[0], 16), int(v[1], 16)+1)
-
- for protocol in ver_range:
- if protocol in ofp_versions:
- br_protos.append(ofp_versions[protocol])
-
- # Collect flow information for relevant protocol versions only
- for flow in flow_versions:
- if flow in br_protos:
+ vrf_list = self.collect_cmd_output(
+ "%s vrf/list %s" % (self.actl, bri))
+ if vrf_list['status'] == 0:
+ vrfs = vrf_list['output'].split()[1:]
+ for vrf in vrfs:
self.add_cmd_output([
- "ovs-ofctl -O %s show %s" % (flow, br),
- "ovs-ofctl -O %s dump-groups %s" % (flow, br),
- "ovs-ofctl -O %s dump-group-stats %s" % (flow, br),
- "ovs-ofctl -O %s dump-flows %s" % (flow, br),
- "ovs-ofctl -O %s dump-tlv-map %s" % (flow, br),
- "ovs-ofctl -O %s dump-ports-desc %s" % (flow, br)
+ "%s vrf/route-table %s" % (self.actl, vrf),
])
- port_list_result = self.exec_cmd(
- "ovs-vsctl -t 5 list-ports %s" % br
- )
- if port_list_result['status'] == 0:
- for port in port_list_result['output'].splitlines():
+ evpn_list = self.collect_cmd_output(
+ "ovs-appctl evpn/list %s" % bri)
+ if evpn_list['status'] == 0:
+ evpns = evpn_list['output'].split()[1:]
+ for evpn in evpns:
self.add_cmd_output([
- "ovs-appctl cfm/show %s" % port,
- "ovs-appctl qos/show %s" % port,
- # Not all ports are "bond"s, but all "bond"s are
- # a single port
- "ovs-appctl bond/show %s" % port,
- # In the case of IPSec, we should pull the config
- "ovs-vsctl get Interface %s options" % port,
+ f"{self.actl} evpn/mac-table {evpn}",
+ f"{self.actl} evpn/arp-table {evpn}",
+ f"{self.actl} evpn/dump-flows {bri} {evpn}",
+ f"{self.actl} evpn/dhcp-pool-show {bri} {evpn}",
+ f"{self.actl} evpn/dhcp-relay-show {bri} {evpn}",
+ f"{self.actl} evpn/dhcp-static-show {bri} {evpn}",
+ f"{self.actl} evpn/dhcp-table-show {bri} {evpn}",
+ f"{self.actl} evpn/proxy-arp-filter-list "
+ f"{bri} {evpn}",
+ f"{self.actl} evpn/show {bri} {evpn}",
+ f"{self.actl} port/dscp-table {bri} {evpn}",
])
- if check_dpdk:
- self.add_cmd_output(
- "ovs-appctl netdev-dpdk/get-mempool-info %s" %
- port
- )
-
- if check_dpdk:
- iface_list_result = self.exec_cmd(
- "ovs-vsctl -t 5 list-ifaces %s" % br
- )
- if iface_list_result['status'] == 0:
- for iface in iface_list_result['output'].splitlines():
- self.add_cmd_output(
- "ovs-appctl netdev-dpdk/get-mempool-info %s" %
- iface)
- if check_6wind:
- self.add_cmd_output([
- "%s evpn/vip-list-show %s" % (actl, br),
- "%s bridge/dump-conntracks-summary %s" % (actl, br),
- "%s bridge/acl-table ingress/egress %s" % (actl, br),
- "%s bridge/acl-table %s" % (actl, br),
- "%s ofproto/show %s" % (actl, br),
+ def get_flow_versions(self, bridge):
+ """ Collect flow version of the given bridge """
+ # Flow protocols currently supported
+ flow_versions = [
+ "OpenFlow10",
+ "OpenFlow11",
+ "OpenFlow12",
+ "OpenFlow13",
+ "OpenFlow14",
+ "OpenFlow15"
+ ]
+
+ # Flow protocol hex identifiers
+ ofp_versions = {
+ 0x01: "OpenFlow10",
+ 0x02: "OpenFlow11",
+ 0x03: "OpenFlow12",
+ 0x04: "OpenFlow13",
+ 0x05: "OpenFlow14",
+ 0x06: "OpenFlow15",
+ }
+
+ ofp_ver_result = self.collect_cmd_output("ovs-ofctl -t 5 --version")
+
+ # List protocols currently in use, if any
+ br_info = self.collect_cmd_output(f"ovs-vsctl -t 5 list "
+ f"bridge {bridge}")
+
+ br_protos = []
+ for line in br_info['output'].splitlines():
+ if "protocols" in line:
+ br_protos_ln = line[line.find("[")+1:line.find("]")]
+ br_protos = br_protos_ln.replace('"', '').split(", ")
+
+ # If 'list bridge' yeilded no protocols, use the range of
+ # protocols enabled by default on this version of ovs.
+ if br_protos == [''] and ofp_ver_result['output']:
+ ofp_version_range = ofp_ver_result['output'].splitlines()
+ ver_range = []
+
+ for line in ofp_version_range:
+ if "OpenFlow versions" in line:
+ ver_sp = line.split("OpenFlow versions ")
+ ver = ver_sp[1].split(":")
+ ver_range = range(int(ver[0], 16),
+ int(ver[1], 16)+1)
+
+ for protocol in ver_range:
+ if protocol in ofp_versions:
+ br_protos.append(ofp_versions[protocol])
+
+ # Collect flow information for relevant protocol versions only
+ for flow in flow_versions:
+ if flow in br_protos:
+ self.add_cmd_output([
+ f"ovs-ofctl -O {flow} show {bridge}",
+ f"ovs-ofctl -O {flow} dump-groups {bridge}",
+ f"ovs-ofctl -O {flow} dump-group-stats {bridge}",
+ f"ovs-ofctl -O {flow} dump-flows {bridge}",
+ f"ovs-ofctl -O {flow} dump-tlv-map {bridge}",
+ f"ovs-ofctl -O {flow} dump-ports-desc {bridge}",
+ ])
+
+ def get_port_list(self, bridge):
+ """ Collect port list of the given bridge """
+ port_list_result = self.exec_cmd(f"ovs-vsctl -t 5 list-ports {bridge}")
+
+ if port_list_result['status'] == 0:
+ for port in port_list_result['output'].splitlines():
+ self.add_cmd_output([
+ "ovs-appctl cfm/show %s" % port,
+ "ovs-appctl qos/show %s" % port,
+ # Not all ports are "bond"s, but all "bond"s are
+ # a single port
+ "ovs-appctl bond/show %s" % port,
+ # In the case of IPSec, we should pull the config
+ "ovs-vsctl get Interface %s options" % port,
])
- vrf_list = self.collect_cmd_output(
- "%s vrf/list %s" % (actl, br))
- if vrf_list['status'] == 0:
- vrfs = vrf_list['output'].split()[1:]
- for vrf in vrfs:
- self.add_cmd_output([
- "%s vrf/route-table %s" % (actl, vrf),
- ])
-
- evpn_list = self.collect_cmd_output(
- "ovs-appctl evpn/list %s" % br)
- if evpn_list['status'] == 0:
- evpns = evpn_list['output'].split()[1:]
- for evpn in evpns:
- self.add_cmd_output([
- "%s evpn/mac-table %s" % (actl, evpn),
- "%s evpn/arp-table %s" % (actl, evpn),
- "%s evpn/dump-flows %s %s" % (actl, br, evpn),
- "%s evpn/dhcp-pool-show %s %s" % (
- actl, br, evpn),
- "%s evpn/dhcp-relay-show %s %s" % (
- actl, br, evpn),
- "%s evpn/dhcp-static-show %s %s" % (
- actl, br, evpn),
- "%s evpn/dhcp-table-show %s %s" % (
- actl, br, evpn),
- "%s evpn/proxy-arp-filter-list %s %s" % (
- actl, br, evpn),
- "%s evpn/show %s %s" % (actl, br, evpn),
- "%s port/dscp-table %s %s" % (actl, br, evpn),
- ])
+ if self.check_dpdk:
+ self.add_cmd_output(
+ "ovs-appctl netdev-dpdk/get-mempool-info %s" % port)
class RedHatOpenVSwitch(OpenVSwitch, RedHatPlugin):
diff --git a/sos/report/plugins/origin.py b/sos/report/plugins/origin.py
index fc523f11..0504a39d 100644
--- a/sos/report/plugins/origin.py
+++ b/sos/report/plugins/origin.py
@@ -8,8 +8,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin
import os.path
+from sos.report.plugins import Plugin, RedHatPlugin
# This plugin collects static configuration and runtime information
# about OpenShift Origin based environments, like OpenShift Enterprise 3
@@ -107,7 +107,8 @@ class OpenShiftOrigin(Plugin):
if self.is_static_etcd():
self.add_cmd_output("%s etcd etcd" % static_pod_logs_cmd)
- # TODO: some thoughts about information that might also be useful
+ # Possible enhancements:
+ # some thoughts about information that might also be useful
# to collect. However, these are maybe not needed in general
# and/or present some challenges (scale, sensitive, ...) and need
# some more thought. For now just leaving this comment here until
diff --git a/sos/report/plugins/ovirt.py b/sos/report/plugins/ovirt.py
index a374e639..cbd97af6 100644
--- a/sos/report/plugins/ovirt.py
+++ b/sos/report/plugins/ovirt.py
@@ -67,8 +67,8 @@ class Ovirt(Plugin, RedHatPlugin):
if self.get_option('jbosstrace') and self.is_installed('ovirt-engine'):
engine_pattern = r"^ovirt-engine\ -server.*jboss-modules.jar"
pgrep = "pgrep -f '%s'" % engine_pattern
- r = self.exec_cmd(pgrep)
- engine_pids = [int(x) for x in r['output'].splitlines()]
+ res = self.exec_cmd(pgrep)
+ engine_pids = [int(x) for x in res['output'].splitlines()]
if not engine_pids:
self.soslog.error('Unable to get ovirt-engine pid')
self.add_alert('Unable to get ovirt-engine pid')
@@ -76,8 +76,8 @@ class Ovirt(Plugin, RedHatPlugin):
try:
# backtrace written to '/var/log/ovirt-engine/console.log
os.kill(pid, signal.SIGQUIT)
- except OSError as e:
- self.soslog.error('Unable to send signal to %d' % pid, e)
+ except OSError:
+ self.soslog.error(f'Unable to send signal to {pid}')
self.add_forbidden_path([
'/etc/ovirt-engine/.pgpass',
@@ -188,10 +188,10 @@ class Ovirt(Plugin, RedHatPlugin):
"""
Obfuscate sensitive keys.
"""
- for f in ["/etc/ovirt-engine/engine-config/engine-config.properties",
- "/etc/rhevm/rhevm-config/rhevm-config.properties"]:
+ for pro in ["/etc/ovirt-engine/engine-config/engine-config.properties",
+ "/etc/rhevm/rhevm-config/rhevm-config.properties"]:
self.do_file_sub(
- f,
+ pro,
r"(Password.type)=(.*)",
r"\1=********"
)
diff --git a/sos/report/plugins/ovirt_engine_backup.py b/sos/report/plugins/ovirt_engine_backup.py
index 7fb6a5c7..6adf5c98 100644
--- a/sos/report/plugins/ovirt_engine_backup.py
+++ b/sos/report/plugins/ovirt_engine_backup.py
@@ -8,11 +8,11 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
from datetime import datetime
+from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
-class oVirtEngineBackup(Plugin, RedHatPlugin):
+class OVirtEngineBackup(Plugin, RedHatPlugin):
short_desc = 'oVirt Engine database backup'
diff --git a/sos/report/plugins/ovn_central.py b/sos/report/plugins/ovn_central.py
index d61ab495..bcc937f4 100644
--- a/sos/report/plugins/ovn_central.py
+++ b/sos/report/plugins/ovn_central.py
@@ -8,15 +8,15 @@
#
# See the LICENSE file in the source distribution for further information.
+import json
+import os
+import re
from sos.report.plugins import (
Plugin,
RedHatPlugin,
DebianPlugin,
UbuntuPlugin,
)
-import json
-import os
-import re
class OVNCentral(Plugin):
@@ -25,15 +25,21 @@ class OVNCentral(Plugin):
plugin_name = "ovn_central"
profiles = ('network', 'virt')
containers = ('ovn-dbs-bundle.*', 'ovn_cluster_north_db_server')
+ container_name = ""
+ ovn_nbdb_sock_path = ""
+ ovn_sbdb_sock_path = ""
+ ovn_sock_path = ""
+ ovn_controller_sock_regex = ""
+ ovn_northd_sock_regex = ""
def _find_sock(self, path, regex_name):
_sfile = os.path.join(path, regex_name)
- if self._container_name:
- res = self.exec_cmd("ls %s" % path, container=self._container_name)
+ if self.container_name:
+ res = self.exec_cmd("ls %s" % path, container=self.container_name)
if res['status'] != 0 or '\n' not in res['output']:
self._log_error(
"Could not retrieve ovn_controller socket path "
- "from container %s" % self._container_name
+ "from container %s" % self.container_name
)
else:
pattern = re.compile(regex_name)
@@ -43,26 +49,28 @@ class OVNCentral(Plugin):
# File not found, return the regex full path
return _sfile
- def get_tables_from_schema(self, filename, skip=[]):
- if self._container_name:
+ def get_tables_from_schema(self, filename, skip=None):
+ """ Get tables from schema """
+ if self.container_name:
cmd = "cat %s" % filename
res = self.exec_cmd(cmd, timeout=None, foreground=True,
- container=self._container_name)
+ container=self.container_name)
if res['status'] != 0:
self._log_error("Could not retrieve DB schema file from "
- "container %s" % self._container_name)
+ "container %s" % self.container_name)
return None
try:
- db = json.loads(res['output'])
- except Exception:
+ db_schema = json.loads(res['output'])
+ except Exception: # pylint: disable=broad-except
self._log_error("Cannot parse JSON file %s" % filename)
return None
else:
try:
- with open(self.path_join(filename), 'r') as f:
+ fname = self.path_join(filename)
+ with open(fname, 'r', encoding='UTF-8') as file:
try:
- db = json.load(f)
- except Exception:
+ db_schema = json.load(file)
+ except Exception: # pylint: disable=broad-except
self._log_error(
"Cannot parse JSON file %s" % filename)
return None
@@ -72,12 +80,13 @@ class OVNCentral(Plugin):
return None
try:
return [table for table in dict.keys(
- db['tables']) if table not in skip]
+ db_schema['tables']) if table not in skip]
except AttributeError:
self._log_error("DB schema %s has no 'tables' key" % filename)
return None
def add_database_output(self, tables, cmds, ovn_cmd):
+ """ Collect OVN database output """
if not tables:
return
for table in tables:
@@ -86,10 +95,10 @@ class OVNCentral(Plugin):
def setup(self):
# check if env is a clustered or non-clustered one
if self.container_exists(self.containers[1]):
- self._container_name = self.get_container_by_name(
+ self.container_name = self.get_container_by_name(
self.containers[1])
else:
- self._container_name = self.get_container_by_name(
+ self.container_name = self.get_container_by_name(
self.containers[0])
ovs_rundir = os.environ.get('OVS_RUNDIR')
@@ -122,7 +131,7 @@ class OVNCentral(Plugin):
f"ovn-appctl -t {northd_sock_path} status",
f"ovn-appctl -t {northd_sock_path} debug/chassis-features-list",
f"ovn-appctl -t {ovn_controller_sock_path} connection-status",
- ], foreground=True, container=self._container_name, timeout=30
+ ], foreground=True, container=self.container_name, timeout=30
)
# Some user-friendly versions of DB output
@@ -160,7 +169,7 @@ class OVNCentral(Plugin):
# failing on collecting output to file on container running commands
cmds = list(set(cmds))
self.add_cmd_output(
- cmds, foreground=True, container=self._container_name
+ cmds, foreground=True, container=self.container_name
)
self.add_copy_spec("/etc/sysconfig/ovn-northd")
diff --git a/sos/report/plugins/ovn_host.py b/sos/report/plugins/ovn_host.py
index 5dffb9c6..fb080af0 100644
--- a/sos/report/plugins/ovn_host.py
+++ b/sos/report/plugins/ovn_host.py
@@ -12,30 +12,29 @@ import os
from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-pidfile = 'ovn-controller.pid'
-pid_paths = [
- '/var/lib/openvswitch/ovn',
- '/usr/local/var/run/openvswitch',
- '/run/openvswitch'
-]
-
-
class OVNHost(Plugin):
short_desc = 'OVN Controller'
plugin_name = "ovn_host"
profiles = ('network', 'virt', 'openstack_edpm')
+ pidfile = 'ovn-controller.pid'
+ pid_paths = [
+ '/var/lib/openvswitch/ovn',
+ '/usr/local/var/run/openvswitch',
+ '/run/openvswitch',
+ ]
def setup(self):
if os.environ.get('OVS_RUNDIR'):
- pid_paths.append(os.environ.get('OVS_RUNDIR'))
+ self.pid_paths.append(os.environ.get('OVS_RUNDIR'))
if self.get_option("all_logs"):
self.add_copy_spec("/var/log/ovn/")
else:
self.add_copy_spec("/var/log/ovn/*.log")
- self.add_copy_spec([self.path_join(pp, pidfile) for pp in pid_paths])
+ self.add_copy_spec([self.path_join(pp, self.pidfile)
+ for pp in self.pid_paths])
self.add_copy_spec('/etc/sysconfig/ovn-controller')
@@ -48,9 +47,8 @@ class OVNHost(Plugin):
self.add_journal(units="ovn-controller")
def check_enabled(self):
- return (any([self.path_isfile(
- self.path_join(pp, pidfile)) for pp in pid_paths]) or
- super(OVNHost, self).check_enabled())
+ return (any(self.path_isfile(self.path_join(pid_path, self.pidfile))
+ for pid_path in self.pid_paths) or super().check_enabled())
class RedHatOVNHost(OVNHost, RedHatPlugin):
@@ -59,7 +57,7 @@ class RedHatOVNHost(OVNHost, RedHatPlugin):
var_ansible_gen = "/var/lib/config-data/ansible-generated/ovn-bgp-agent"
def setup(self):
- super(RedHatOVNHost, self).setup()
+ super().setup()
self.add_copy_spec([
self.var_ansible_gen,
])
diff --git a/sos/report/plugins/pam.py b/sos/report/plugins/pam.py
index cee783c8..5dc2fa81 100644
--- a/sos/report/plugins/pam.py
+++ b/sos/report/plugins/pam.py
@@ -40,15 +40,12 @@ class RedHatPam(Pam, RedHatPlugin):
security_libs = "/lib*/security"
def setup(self):
- super(RedHatPam, self).setup()
+ super().setup()
self.add_cmd_output(["authselect current"])
class DebianPam(Pam, DebianPlugin, UbuntuPlugin):
security_libs = "/lib/x86_64-linux-gnu/security"
- def setup(self):
- super(DebianPam, self).setup()
-
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/pci.py b/sos/report/plugins/pci.py
index 49f9b889..34e9e8fb 100644
--- a/sos/report/plugins/pci.py
+++ b/sos/report/plugins/pci.py
@@ -17,6 +17,7 @@ class Pci(Plugin, IndependentPlugin):
profiles = ('hardware', 'system')
def check_for_bus_devices(self):
+ """ Check whether PCI devices present """
if not self.path_isdir('/proc/bus/pci'):
return False
# ensure that more than just the 'devices' file, which can be empty,