diff options
30 files changed, 175 insertions, 88 deletions
diff --git a/example_plugins/example.py b/example_plugins/example.py index 2e39ffee..ac4bc790 100755 --- a/example_plugins/example.py +++ b/example_plugins/example.py @@ -12,7 +12,7 @@ from sos.plugins import Plugin, RedHatPlugin # if you want to override it simply provide a @classmethod name() # that returns the name you want class example(Plugin, RedHatPlugin): - '''This is the description for the example plugin''' + """This is the description for the example plugin""" # Plugin developers want to override setup() from which they will call # add_copy_spec() to collect files and collectExtOutput() to collect programs # output. @@ -27,13 +27,13 @@ class example(Plugin, RedHatPlugin): ('color', 'Gathers toenail polish color', 'fast', 0)] def setup(self): - ''' First phase - Collect all the information we need. + """ First phase - Collect all the information we need. Directories are copied recursively. arbitrary commands may be executed using the collectExtOutput() method. Information is automatically saved, and links are presented in the report to each file or directory which has been copied to the saved tree. Also, links are provided to the output from each command. - ''' + """ # Here's how to copy files and directory trees self.add_copy_spec("/etc/hosts") diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index b322b5ee..e1ac2deb 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -47,7 +47,7 @@ def _to_u(s): def regex_findall(regex, fname): - '''Return a list of all non overlapping matches in the string(s)''' + """Return a list of all non overlapping matches in the string(s)""" try: with fileobj(fname) as f: return re.findall(regex, f.read(), re.MULTILINE) @@ -205,7 +205,7 @@ class SoSPredicate(object): return all(_pkgs) def _eval_cmd_output(self, cmd_output): - '''Does 'cmd' output contain string 'output'?''' + """Does 'cmd' output contain string 'output'?""" if 'cmd' not in cmd_output or 'output' not in cmd_output: return False result = sos_get_command_output(cmd_output['cmd']) @@ -367,10 +367,10 @@ class Plugin(object): @property def timeout(self): - '''Returns either the default plugin timeout value, the value as + """Returns either the default plugin timeout value, the value as provided on the commandline via -k plugin.timeout=value, or the value of the global --plugin-timeout option. - ''' + """ _timeout = None try: opt_timeout = self.get_option('plugin_timeout') @@ -390,7 +390,7 @@ class Plugin(object): return self.plugin_timeout def check_timeout(self): - ''' + """ Checks to see if the plugin has hit its timeout. This is set when the sos.collect_plugin() method hits a timeout and @@ -404,7 +404,7 @@ class Plugin(object): Returns True if timeout has been hit, else False. - ''' + """ return self._timeout_hit @classmethod @@ -451,27 +451,27 @@ class Plugin(object): return os.path.commonprefix(paths) == self.sysroot def is_installed(self, package_name): - '''Is the package $package_name installed?''' + """Is the package $package_name installed?""" return self.policy.pkg_by_name(package_name) is not None def is_service(self, name): - '''Does the service $name exist on the system?''' + """Does the service $name exist on the system?""" return self.policy.init_system.is_service(name) def is_service_enabled(self, name): - '''Is the service $name enabled?''' + """Is the service $name enabled?""" return self.policy.init_system.is_enabled(name) def is_service_disabled(self, name): - '''Is the service $name disabled?''' + """Is the service $name disabled?""" return self.policy.init_system.is_disabled(name) def is_service_running(self, name): - '''Is the service $name currently running?''' + """Is the service $name currently running?""" return self.policy.init_system.is_running(name) def get_service_status(self, name): - '''Return the reported status for service $name''' + """Return the reported status for service $name""" return self.policy.init_system.get_service_status(name)['status'] def set_predicate(self, pred): @@ -537,13 +537,13 @@ class Plugin(object): self._log_warn(msg % (cmd, needs)) def do_cmd_private_sub(self, cmd, desc=""): - '''Remove certificate and key output archived by sosreport. cmd + """Remove certificate and key output archived by sosreport. cmd is the command name from which output is collected (i.e. exlcuding parameters). Any matching instances are replaced with: '-----SCRUBBED' and this function does not take a regexp or substituting string. This function returns the number of replacements made. - ''' + """ if not self.executed_commands: return 0 @@ -555,7 +555,7 @@ class Plugin(object): return self.do_cmd_output_sub(cmd, _certmatch, replace) def do_cmd_output_sub(self, cmd, regexp, subst): - '''Apply a regexp substitution to command output archived by sosreport. + """Apply a regexp substitution to command output archived by sosreport. cmd is the command name from which output is collected (i.e. excluding parameters). The regexp can be a string or a compiled re object. The substitution string, subst, is a string that replaces each occurrence @@ -564,7 +564,7 @@ class Plugin(object): the current module's command list is subjected to the replacement. This function returns the number of replacements made. - ''' + """ globstr = '*' + cmd + '*' pattern = regexp.pattern if hasattr(regexp, "pattern") else regexp self._log_debug("substituting '%s' for '%s' in commands matching '%s'" @@ -599,7 +599,7 @@ class Plugin(object): return replacements def do_file_private_sub(self, pathregex, desc=""): - '''Scrub certificate/key/etc information from files collected by sos. + """Scrub certificate/key/etc information from files collected by sos. Files matching the provided pathregex are searched for content that resembles certificate, ssh keys, or similar information. Any matches @@ -611,7 +611,7 @@ class Plugin(object): Positional arguments: :param pathregex: A string or regex of a filename to match against :param desc: A description of the replaced content - ''' + """ self._log_debug("Scrubbing certs and keys for paths matching %s" % pathregex) match = re.compile(pathregex).match @@ -624,13 +624,13 @@ class Plugin(object): self.do_file_sub(path, _certmatch, replace) def do_file_sub(self, srcpath, regexp, subst): - '''Apply a regexp substitution to a file archived by sosreport. + """Apply a regexp substitution to a file archived by sosreport. srcpath is the path in the archive where the file can be found. regexp can be a regexp string or a compiled re object. subst is a string to replace each occurance of regexp in the content of srcpath. This function returns the number of replacements made. - ''' + """ try: path = self._get_dest_for_srcpath(srcpath) pattern = regexp.pattern if hasattr(regexp, "pattern") else regexp @@ -661,12 +661,12 @@ class Plugin(object): return replacements def do_path_regex_sub(self, pathexp, regexp, subst): - '''Apply a regexp substituation to a set of files archived by + """Apply a regexp substituation to a set of files archived by sos. The set of files to be substituted is generated by matching collected file pathnames against pathexp which may be a regular expression string or compiled re object. The portion of the file to be replaced is specified via regexp and the replacement string - is passed in subst.''' + is passed in subst.""" if not hasattr(pathexp, "match"): pathexp = re.compile(pathexp) match = pathexp.match @@ -773,10 +773,10 @@ class Plugin(object): # Methods for copying files and shelling out def _do_copy_path(self, srcpath, dest=None): - '''Copy file or directory to the destination tree. If a directory, then + """Copy file or directory to the destination tree. If a directory, then everything below it is recursively copied. A list of copied files are saved for use later in preparing a report. - ''' + """ if self._timeout_hit: return @@ -895,9 +895,9 @@ class Plugin(object): return default def get_option_as_list(self, optionname, delimiter=",", default=None): - '''Will try to return the option as a list separated by the + """Will try to return the option as a list separated by the delimiter. - ''' + """ option = self.get_option(optionname) try: opt_list = [opt.strip() for opt in option.split(delimiter)] @@ -1302,13 +1302,13 @@ class Plugin(object): self.custom_text += text def add_service_status(self, services, timeout=None, pred=None): - '''Collect service status information based on the InitSystem used. + """Collect service status information based on the InitSystem used. :param services: A string, or list of strings, specifying the services to collect :param timeout: Optional timeout in seconds :param pred: An optional predicate to gate collection - ''' + """ if isinstance(services, six.string_types): services = [services] diff --git a/sos/plugins/cloud_init.py b/sos/plugins/cloud_init.py index 09f3089c..b92104e3 100644 --- a/sos/plugins/cloud_init.py +++ b/sos/plugins/cloud_init.py @@ -12,8 +12,8 @@ from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin class CloudInit(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin): - '''cloud-init instance configurations - ''' + """cloud-init instance configurations + """ plugin_name = 'cloud_init' packages = ('cloud-init',) diff --git a/sos/plugins/cockpit.py b/sos/plugins/cockpit.py index 7160fa87..8917f190 100644 --- a/sos/plugins/cockpit.py +++ b/sos/plugins/cockpit.py @@ -12,7 +12,7 @@ from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin class Cockpit(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): - '''Cockpit Web Service''' + """Cockpit Web Service""" plugin_name = 'cockpit' packages = ('cockpit-ws', 'cockpit-system') diff --git a/sos/plugins/collectd.py b/sos/plugins/collectd.py index 2e528fe9..d1f49bc3 100644 --- a/sos/plugins/collectd.py +++ b/sos/plugins/collectd.py @@ -12,18 +12,24 @@ from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin class Collectd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): - ''' + """ Collectd config collector - ''' + """ plugin_name = "collectd" profiles = ('services', 'webserver') + # enable the plugin either when collectd package is installed + # or being inside Super Proviledged Container that does not have + # the package but logs to the host's logfile packages = ('collectd',) + files = ('/var/log/containers/collectd/collectd.log') def setup(self): self.add_copy_spec([ '/etc/collectd.conf', '/etc/collectd.d/*.conf', + '/var/log/containers/collectd/collectd.log', + '/var/lib/config-data/collectd', ]) p = re.compile('^LoadPlugin.*') diff --git a/sos/plugins/container_log.py b/sos/plugins/container_log.py index 739c9956..392cb1e5 100644 --- a/sos/plugins/container_log.py +++ b/sos/plugins/container_log.py @@ -13,8 +13,8 @@ import os class ContainerLog(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): - '''All container logs - ''' + """All container logs + """ plugin_name = 'container_log' logdir = '/var/log/containers/' files = (logdir, ) @@ -26,8 +26,8 @@ class ContainerLog(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): self.collect_subdirs() def collect_subdirs(self, root=logdir): - '''Collect *.log files from subdirs of passed root path - ''' + """Collect *.log files from subdirs of passed root path + """ for dirName, _, _ in os.walk(root): self.add_copy_spec(os.path.join(dirName, '*.log')) diff --git a/sos/plugins/convert2rhel.py b/sos/plugins/convert2rhel.py new file mode 100644 index 00000000..833a9f34 --- /dev/null +++ b/sos/plugins/convert2rhel.py @@ -0,0 +1,27 @@ +# This file is part of the sos project: https://github.com/sosreport/sos +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# version 2 of the GNU General Public License. +# +# See the LICENSE file in the source distribution for further information. + +from sos.plugins import Plugin, RedHatPlugin + + +class convert2rhel(Plugin, RedHatPlugin): + + plugin_name = 'convert2rhel' + profiles = ('system') + packages = ('convert2rhel') + verify_packages = ('convert2rhel$',) + + def setup(self): + + self.add_copy_spec([ + "/var/log/convert2rhel/convert2rhel.log", + "/var/log/convert2rhel/rpm_va.log" + ]) + + +# vim: set et ts=4 sw=4 : diff --git a/sos/plugins/date.py b/sos/plugins/date.py index 51a7e88e..fec3d664 100644 --- a/sos/plugins/date.py +++ b/sos/plugins/date.py @@ -12,8 +12,8 @@ from sos.plugins import Plugin, RedHatPlugin, DebianPlugin class Date(Plugin, RedHatPlugin, DebianPlugin): - '''Basic system time information - ''' + """Basic system time information + """ plugin_name = 'date' diff --git a/sos/plugins/fibrechannel.py b/sos/plugins/fibrechannel.py index 30fc6a54..7f41fbd2 100644 --- a/sos/plugins/fibrechannel.py +++ b/sos/plugins/fibrechannel.py @@ -15,7 +15,7 @@ from os.path import isdir, join class Fibrechannel(Plugin, RedHatPlugin): - '''Collects information on fibrechannel devices, if present''' + """Collects information on fibrechannel devices, if present""" plugin_name = 'fibrechannel' profiles = ('hardware', 'storage', 'system') diff --git a/sos/plugins/firewalld.py b/sos/plugins/firewalld.py index 26731fd3..f7b41c4a 100644 --- a/sos/plugins/firewalld.py +++ b/sos/plugins/firewalld.py @@ -9,7 +9,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, SoSPredicate class FirewallD(Plugin, RedHatPlugin): @@ -33,7 +33,10 @@ class FirewallD(Plugin, RedHatPlugin): ]) # collect nftables ruleset - self.add_cmd_output("nft list ruleset") + nft_pred = SoSPredicate(self, + kmods=['nf_tables', 'nfnetlink'], + required={'kmods': 'all'}) + self.add_cmd_output("nft list ruleset", pred=nft_pred, changes=True) # use a 10s timeout to workaround dbus problems in # docker containers. diff --git a/sos/plugins/host.py b/sos/plugins/host.py index 8caeae0b..0073d7cb 100644 --- a/sos/plugins/host.py +++ b/sos/plugins/host.py @@ -12,8 +12,8 @@ from sos.plugins import Plugin, RedHatPlugin, DebianPlugin class Host(Plugin, RedHatPlugin, DebianPlugin): - '''Host information - ''' + """Host information + """ plugin_name = 'host' profiles = ('system',) diff --git a/sos/plugins/insights.py b/sos/plugins/insights.py index 720d33a6..a944e494 100644 --- a/sos/plugins/insights.py +++ b/sos/plugins/insights.py @@ -10,8 +10,8 @@ from sos.plugins import Plugin, RedHatPlugin class RedHatInsights(Plugin, RedHatPlugin): - '''Collect config and log for Red Hat Insights - ''' + """Collect config and log for Red Hat Insights + """ plugin_name = 'insights' packages = ['redhat-access-insights', 'insights-client'] profiles = ('system', 'sysmgmt') diff --git a/sos/plugins/ipa.py b/sos/plugins/ipa.py index d3454de9..273d8509 100644 --- a/sos/plugins/ipa.py +++ b/sos/plugins/ipa.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, SoSPredicate from glob import glob from os.path import exists @@ -152,7 +152,6 @@ class Ipa(Plugin, RedHatPlugin): self.add_cmd_output([ "ls -la /etc/dirsrv/slapd-*/schema/", - "getcert list", "certutil -L -d /etc/httpd/alias/", "pki-server cert-find --show-all", "pki-server subsystem-cert-validate ca", @@ -161,6 +160,11 @@ class Ipa(Plugin, RedHatPlugin): "klist -ket /var/lib/ipa/gssproxy/http.keytab" ]) + getcert_pred = SoSPredicate(self, + services=['certmonger']) + + self.add_cmd_output("getcert list", pred=getcert_pred) + for certdb_directory in glob("/etc/dirsrv/slapd-*/"): self.add_cmd_output("certutil -L -d %s" % certdb_directory) return diff --git a/sos/plugins/kernelrt.py b/sos/plugins/kernelrt.py index d4aa8adc..ae57f03a 100644 --- a/sos/plugins/kernelrt.py +++ b/sos/plugins/kernelrt.py @@ -13,8 +13,8 @@ from sos.plugins import Plugin, RedHatPlugin class KernelRT(Plugin, RedHatPlugin): - '''Realtime kernel variant - ''' + """Realtime kernel variant + """ plugin_name = 'kernelrt' profiles = ('system', 'hardware', 'kernel', 'mrg') diff --git a/sos/plugins/lustre.py b/sos/plugins/lustre.py index 98ca09f6..25c9333f 100644 --- a/sos/plugins/lustre.py +++ b/sos/plugins/lustre.py @@ -10,17 +10,17 @@ from sos.plugins import Plugin, RedHatPlugin class Lustre(Plugin, RedHatPlugin): - '''Lustre filesystem''' + """Lustre filesystem""" plugin_name = 'lustre' profiles = ('storage', 'network', 'cluster', ) packages = ('lustre', 'lustre-client', ) def get_params(self, name, param_list): - '''Use lctl get_param to collect a selection of parameters into a + """Use lctl get_param to collect a selection of parameters into a file. - ''' + """ self.add_cmd_output("lctl get_param %s" % " ".join(param_list), suggest_filename="params-%s" % name, stderr=False) diff --git a/sos/plugins/nvidia.py b/sos/plugins/nvidia.py index 7efd8db9..ecf3daeb 100644 --- a/sos/plugins/nvidia.py +++ b/sos/plugins/nvidia.py @@ -13,7 +13,7 @@ from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin class Nvidia(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): - '''Nvidia GPU information''' + """Nvidia GPU information""" commands = ('nvidia-smi',) diff --git a/sos/plugins/omsa.py b/sos/plugins/omsa.py index dbf17236..d78d583d 100644 --- a/sos/plugins/omsa.py +++ b/sos/plugins/omsa.py @@ -10,8 +10,8 @@ from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin class omsa(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): - '''Dell OpenManage Server Administrator (OMSA) - ''' + """Dell OpenManage Server Administrator (OMSA) + """ plugin_name = 'omsa' profiles = ('hardware', 'debug') diff --git a/sos/plugins/openshift.py b/sos/plugins/openshift.py index a3e29fd7..e31040c3 100644 --- a/sos/plugins/openshift.py +++ b/sos/plugins/openshift.py @@ -17,7 +17,7 @@ import os.path # For later of OpenShift Origin based on: https://github.com/openshift/origin # like OpenShift Enterprise 3.x see the origin.py plugin class Openshift(Plugin, RedHatPlugin): - '''Openshift 2.x node and broker''' + """Openshift 2.x node and broker""" plugin_name = "openshift" profiles = ('virt', 'openshift') diff --git a/sos/plugins/openstack_tripleo.py b/sos/plugins/openstack_tripleo.py new file mode 100644 index 00000000..652d132f --- /dev/null +++ b/sos/plugins/openstack_tripleo.py @@ -0,0 +1,47 @@ +# Copyright (C) 2020 Red Hat, Inc., Cedric Jeanneret <cjeanner@redhat.com> + +# This file is part of the sos project: https://github.com/sosreport/sos +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# version 2 of the GNU General Public License. +# +# See the LICENSE file in the source distribution for further information. + +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +import re + + +class OpenStackTripleO(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): + """Fetch installation informations from OpenStack Installer + """ + + plugin_name = 'openstack_tripleo' + profiles = ('openstack', 'openstack_controller', 'openstack_compute') + packages = ('openstack-selinux',) + + def setup(self): + # Notes: recursion is max 2 for container-puppet and tripleo-config + # Those directories are present on all OpenStack nodes + self.add_copy_spec([ + '/var/log/paunch.log', + '/var/lib/container-puppet/', + '/var/lib/tripleo-config/', + '/etc/puppet/hieradata/' + ]) + + def postproc(self): + # Ensures we do not leak passwords from the tripleo-config and + # hieradata locations. + # Other locations don't have sensitive data. + secrets = r'(".*(key|password|pass|secret|database_connection))' \ + r'([":\s]+)(.*[^"])([",]+)' + rgxp = re.compile(secrets, re.IGNORECASE) + + self.do_path_regex_sub('/var/lib/tripleo-config/', + rgxp, r'\1\3*********\5') + self.do_path_regex_sub('/etc/puppet/hieradata/', + rgxp, r'\1\3*********\5') + + +# vim: set et ts=4 sw=4 : diff --git a/sos/plugins/origin.py b/sos/plugins/origin.py index 9042a522..aecd698a 100644 --- a/sos/plugins/origin.py +++ b/sos/plugins/origin.py @@ -33,7 +33,7 @@ import os.path class OpenShiftOrigin(Plugin): - ''' OpenShift Origin ''' + """ OpenShift Origin """ plugin_name = "origin" files = None # file lists assigned after path setup below @@ -68,19 +68,19 @@ class OpenShiftOrigin(Plugin): # single instance (at least one must evaluate True if this is an OpenShift # installation) def is_master(self): - '''Determine if we are on a master''' + """Determine if we are on a master""" return os.path.exists(self.master_cfg) def is_node(self): - '''Determine if we are on a node''' + """Determine if we are on a node""" return os.path.exists(self.node_cfg) def is_static_etcd(self): - '''Determine if we are on a node running etcd''' + """Determine if we are on a node running etcd""" return os.path.exists(os.path.join(self.static_pod_dir, "etcd.yaml")) def is_static_pod_compatible(self): - '''Determine if a node is running static pods''' + """Determine if a node is running static pods""" return os.path.exists(self.static_pod_dir) def setup(self): @@ -224,8 +224,8 @@ class OpenShiftOrigin(Plugin): class AtomicOpenShift(OpenShiftOrigin, RedHatPlugin): - ''' OpenShift Enterprise / OpenShift Container Platform - ''' + """ OpenShift Enterprise / OpenShift Container Platform + """ packages = ('atomic-openshift',) diff --git a/sos/plugins/peripety.py b/sos/plugins/peripety.py index 42877c66..d5f11d57 100644 --- a/sos/plugins/peripety.py +++ b/sos/plugins/peripety.py @@ -14,7 +14,7 @@ import glob class Peripety(Plugin, RedHatPlugin): - '''Peripety Storage Event Monitor''' + """Peripety Storage Event Monitor""" packages = ('peripety',) services = ('peripetyd',) diff --git a/sos/plugins/qt.py b/sos/plugins/qt.py index f35cd21b..9690775c 100644 --- a/sos/plugins/qt.py +++ b/sos/plugins/qt.py @@ -12,7 +12,7 @@ from sos.plugins import Plugin, RedHatPlugin class Qt(Plugin, RedHatPlugin): - '''QT widget toolkit''' + """QT widget toolkit""" plugin_name = 'qt' packages = ('qt', ) diff --git a/sos/plugins/rasdaemon.py b/sos/plugins/rasdaemon.py index 1e8a6995..a33e6305 100644 --- a/sos/plugins/rasdaemon.py +++ b/sos/plugins/rasdaemon.py @@ -12,8 +12,8 @@ from sos.plugins import Plugin, RedHatPlugin class Rasdaemon(Plugin, RedHatPlugin): - '''rasdaemon kernel trace event monitor - ''' + """rasdaemon kernel trace event monitor + """ plugin_name = 'rasdaemon' packages = ('rasdaemon', ) diff --git a/sos/plugins/sapnw.py b/sos/plugins/sapnw.py index 9ce9c8ed..8e2b262a 100644 --- a/sos/plugins/sapnw.py +++ b/sos/plugins/sapnw.py @@ -32,14 +32,13 @@ class sapnw(Plugin, RedHatPlugin): "/usr/sap/hostctrl/exe/saphostctrl -function ListInstances", suggest_filename="SAPInstances" ) - if not inst_out: + if inst_out['status'] != 0: return sidsunique = set() # Cycle through all the instances, get 'sid', 'instance_number' # and 'vhost' to determine the proper profile - p = open(inst_out, "r").read().splitlines() - for inst_line in p: + for inst_line in inst_out['output'].splitlines(): if "DAA" not in inst_line: fields = inst_line.strip().split() sid = fields[3] @@ -99,11 +98,10 @@ class sapnw(Plugin, RedHatPlugin): suggest_filename="SAPDatabases" ) - if not db_out: + if db_out['status'] != 0: return - dbl = open(db_out, "r").read().splitlines() - for line in dbl: + for line in db_out['output'].splitlines(): if "Instance name" in line: fields = line.strip().split() dbadm = fields[2][:-1] diff --git a/sos/plugins/snappy.py b/sos/plugins/snappy.py index 20d32de5..06d72654 100644 --- a/sos/plugins/snappy.py +++ b/sos/plugins/snappy.py @@ -16,7 +16,7 @@ class Snappy(Plugin, UbuntuPlugin, DebianPlugin, RedHatPlugin): plugin_name = 'snappy' profiles = ('system', 'sysmgmt', 'packagemanager') - files = ('/usr/bin/snap') + packages = ('snapd',) def setup(self): self.add_cmd_output([ diff --git a/sos/plugins/stratis.py b/sos/plugins/stratis.py index c5342b5a..994b5175 100644 --- a/sos/plugins/stratis.py +++ b/sos/plugins/stratis.py @@ -12,7 +12,7 @@ from sos.plugins import Plugin, RedHatPlugin class Stratis(Plugin, RedHatPlugin): - '''Stratis Storage''' + """Stratis Storage""" packages = ('stratis-cli', 'stratisd') services = ('stratisd',) diff --git a/sos/plugins/subscription_manager.py b/sos/plugins/subscription_manager.py index 4c8e3a7c..b4aa29ea 100644 --- a/sos/plugins/subscription_manager.py +++ b/sos/plugins/subscription_manager.py @@ -33,6 +33,8 @@ class SubscriptionManager(Plugin, RedHatPlugin): "subscription-manager list --all --available", "subscription-manager list --consumed", "subscription-manager identity", + "subscription-manager release --show", + "subscription-manager release --list", "syspurpose show" ]) self.add_cmd_output("rhsm-debug system --sos --no-archive " diff --git a/sos/plugins/unpackaged.py b/sos/plugins/unpackaged.py index 442ddc24..ec7efd99 100644 --- a/sos/plugins/unpackaged.py +++ b/sos/plugins/unpackaged.py @@ -13,10 +13,10 @@ import stat class Unpackaged(Plugin, RedHatPlugin): - ''' + """ Collects a list of files that are not handled by the package manager - ''' + """ def setup(self): diff --git a/sos/sosreport.py b/sos/sosreport.py index dd02771b..c41bdc64 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -1017,8 +1017,8 @@ class SoSReport(object): os._exit(1) def _collect_plugin(self, plugin): - '''Wraps the collect_plugin() method so we can apply a timeout - against the plugin as a whole''' + """Wraps the collect_plugin() method so we can apply a timeout + against the plugin as a whole""" with ThreadPoolExecutor(1) as pool: try: t = pool.submit(self.collect_plugin, plugin) diff --git a/sos/utilities.py b/sos/utilities.py index c3d6ac20..8befbdf6 100644 --- a/sos/utilities.py +++ b/sos/utilities.py @@ -204,12 +204,12 @@ def shell_out(cmd, timeout=30, chroot=None, runat=None): class AsyncReader(threading.Thread): - '''Used to limit command output to a given size without deadlocking + """Used to limit command output to a given size without deadlocking sos. Takes a sizelimit value in MB, and will compile stdout from Popen into a string that is limited to the given sizelimit. - ''' + """ def __init__(self, channel, sizelimit, binary): super(AsyncReader, self).__init__() @@ -225,14 +225,14 @@ class AsyncReader(threading.Thread): self.start() def run(self): - '''Reads from the channel (pipe) that is the output pipe for a + """Reads from the channel (pipe) that is the output pipe for a called Popen. As we are reading from the pipe, the output is added to a deque. After the size of the deque exceeds the sizelimit earlier (older) entries are removed. This means the returned output is chunksize-sensitive, but is not really byte-sensitive. - ''' + """ try: while True: line = self.chan.read(self.chunksize) @@ -246,7 +246,7 @@ class AsyncReader(threading.Thread): self.running = False def get_contents(self): - '''Returns the contents of the deque as a string''' + """Returns the contents of the deque as a string""" # block until command completes or timesout (separate from the plugin # hitting a timeout) while self.running: |