diff options
author | Bryan Quigley <code@bryanquigley.com> | 2020-08-28 20:29:58 -0700 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2020-09-02 10:28:52 -0400 |
commit | a36e1b83040f3f2c63912d4601f4b33821cd4afb (patch) | |
tree | b5eb6a1f3636e501a445c649370751eb81f0349e | |
parent | 31102aff1a9a1a1338f075220edc8bc8f08db593 (diff) | |
download | sos-a36e1b83040f3f2c63912d4601f4b33821cd4afb.tar.gz |
[policies] Make IndependentPlugin work and switch 17 to use it
Switch valid_subclasses to be something we can just add to, and default
it to include IndependentPlugin.
17 plugins switched are those that generally are going to activate via
files =, commands or the like. Not packages. This will allow them to run
without sos being able to determine the OS release.
Closes: #2018
Resolves: #2224
Signed-off-by: Bryan Quigley <code@bryanquigley.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/policies/__init__.py | 17 | ||||
-rw-r--r-- | sos/policies/cos.py | 4 | ||||
-rw-r--r-- | sos/policies/debian.py | 3 | ||||
-rw-r--r-- | sos/policies/ibmkvm.py | 6 | ||||
-rw-r--r-- | sos/policies/redhat.py | 2 | ||||
-rw-r--r-- | sos/policies/suse.py | 2 | ||||
-rw-r--r-- | sos/policies/ubuntu.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/block.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/date.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/hardware.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/host.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/kernel.py | 5 | ||||
-rw-r--r-- | sos/report/plugins/libraries.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/logs.py | 5 | ||||
-rw-r--r-- | sos/report/plugins/memory.py | 5 | ||||
-rw-r--r-- | sos/report/plugins/nvidia.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/opencl.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/opengl.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/pci.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/process.py | 5 | ||||
-rw-r--r-- | sos/report/plugins/processor.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/system.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/vulkan.py | 4 | ||||
-rw-r--r-- | sos/report/plugins/x11.py | 4 |
24 files changed, 45 insertions, 65 deletions
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index 5f7cb0bf..8b7473e3 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -819,26 +819,11 @@ any third party. self.case_id = None self.probe_runtime = probe_runtime self.package_manager = PackageManager() - self._valid_subclasses = [] + self.valid_subclasses = [IndependentPlugin] self.set_exec_path() self._host_sysroot = sysroot self.register_presets(GENERIC_PRESETS) - def get_valid_subclasses(self): - return [IndependentPlugin] + self._valid_subclasses - - def set_valid_subclasses(self, subclasses): - self._valid_subclasses = subclasses - - def del_valid_subclasses(self): - del self._valid_subclasses - - valid_subclasses = property(get_valid_subclasses, - set_valid_subclasses, - del_valid_subclasses, - "list of subclasses that this policy can " - "process") - def check(self, remote=''): """ This function is responsible for determining if the underlying system diff --git a/sos/policies/cos.py b/sos/policies/cos.py index 8d696e8e..b7b25860 100644 --- a/sos/policies/cos.py +++ b/sos/policies/cos.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import CosPlugin +from sos.report.plugins import CosPlugin, IndependentPlugin from sos.policies import LinuxPolicy @@ -30,7 +30,7 @@ class CosPolicy(LinuxPolicy): distro = "Container-Optimized OS" vendor = "Google Cloud Platform" vendor_url = "https://cloud.google.com/container-optimized-os/" - valid_subclasses = [CosPlugin] + valid_subclasses = [CosPlugin, IndependentPlugin] PATH = "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin" @classmethod diff --git a/sos/policies/debian.py b/sos/policies/debian.py index 6e32fac8..d0387652 100644 --- a/sos/policies/debian.py +++ b/sos/policies/debian.py @@ -28,8 +28,7 @@ class DebianPolicy(LinuxPolicy): verify_filter=self._debv_filter, chroot=sysroot, remote_exec=remote_exec) - - self.valid_subclasses = [DebianPlugin] + self.valid_subclasses += [DebianPlugin] def _get_pkg_name_for_binary(self, binary): # for binary not specified inside {..}, return binary itself diff --git a/sos/policies/ibmkvm.py b/sos/policies/ibmkvm.py index 29aa5b9a..91f272d6 100644 --- a/sos/policies/ibmkvm.py +++ b/sos/policies/ibmkvm.py @@ -10,7 +10,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import PowerKVMPlugin, ZKVMPlugin, RedHatPlugin +from sos.report.plugins import PowerKVMPlugin, ZKVMPlugin from sos.policies.redhat import RedHatPolicy import os @@ -26,7 +26,7 @@ class PowerKVMPolicy(RedHatPolicy): super(PowerKVMPolicy, self).__init__(sysroot=sysroot, init=init, probe_runtime=probe_runtime, remote_exec=remote_exec) - self.valid_subclasses = [PowerKVMPlugin, RedHatPlugin] + self.valid_subclasses += [PowerKVMPlugin] @classmethod def check(cls, remote=''): @@ -54,7 +54,7 @@ class ZKVMPolicy(RedHatPolicy): def __init__(self, sysroot=None): super(ZKVMPolicy, self).__init__(sysroot=sysroot) - self.valid_subclasses = [ZKVMPlugin, RedHatPlugin] + self.valid_subclasses += [ZKVMPlugin] @classmethod def check(cls, remote=''): diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py index 0533e6dc..34b421f3 100644 --- a/sos/policies/redhat.py +++ b/sos/policies/redhat.py @@ -61,7 +61,7 @@ class RedHatPolicy(LinuxPolicy): chroot=sysroot, remote_exec=remote_exec) - self.valid_subclasses = [RedHatPlugin] + self.valid_subclasses += [RedHatPlugin] self.pkgs = self.package_manager.all_pkgs() diff --git a/sos/policies/suse.py b/sos/policies/suse.py index 8ef39055..a64a811c 100644 --- a/sos/policies/suse.py +++ b/sos/policies/suse.py @@ -29,7 +29,7 @@ class SuSEPolicy(LinuxPolicy): self.package_manager = PackageManager( 'rpm -qa --queryformat "%{NAME}|%{VERSION}\\n"', remote_exec=remote_exec) - self.valid_subclasses = [SuSEPlugin, RedHatPlugin] + self.valid_subclasses += [SuSEPlugin, RedHatPlugin] pkgs = self.package_manager.all_pkgs() diff --git a/sos/policies/ubuntu.py b/sos/policies/ubuntu.py index a4b0de8d..8ec765e4 100644 --- a/sos/policies/ubuntu.py +++ b/sos/policies/ubuntu.py @@ -1,4 +1,4 @@ -from sos.report.plugins import UbuntuPlugin, DebianPlugin +from sos.report.plugins import UbuntuPlugin from sos.policies.debian import DebianPolicy import os @@ -20,7 +20,7 @@ class UbuntuPolicy(DebianPolicy): super(UbuntuPolicy, self).__init__(sysroot=sysroot, init=init, probe_runtime=probe_runtime, remote_exec=remote_exec) - self.valid_subclasses = [UbuntuPlugin, DebianPlugin] + self.valid_subclasses += [UbuntuPlugin] @classmethod def check(cls, remote=''): diff --git a/sos/report/plugins/block.py b/sos/report/plugins/block.py index 69548af6..0282cfd2 100644 --- a/sos/report/plugins/block.py +++ b/sos/report/plugins/block.py @@ -6,10 +6,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class Block(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): +class Block(Plugin, IndependentPlugin): short_desc = 'Block device information' diff --git a/sos/report/plugins/date.py b/sos/report/plugins/date.py index d20fc443..fa4de73d 100644 --- a/sos/report/plugins/date.py +++ b/sos/report/plugins/date.py @@ -8,10 +8,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class Date(Plugin, RedHatPlugin, DebianPlugin): +class Date(Plugin, IndependentPlugin): short_desc = 'Basic system time information' diff --git a/sos/report/plugins/hardware.py b/sos/report/plugins/hardware.py index b27cec31..ea8e61ad 100644 --- a/sos/report/plugins/hardware.py +++ b/sos/report/plugins/hardware.py @@ -6,10 +6,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class Hardware(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): +class Hardware(Plugin, IndependentPlugin): short_desc = 'General hardware information' diff --git a/sos/report/plugins/host.py b/sos/report/plugins/host.py index a5f87ede..5e21da7b 100644 --- a/sos/report/plugins/host.py +++ b/sos/report/plugins/host.py @@ -8,10 +8,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class Host(Plugin, RedHatPlugin, DebianPlugin): +class Host(Plugin, IndependentPlugin): short_desc = 'Host information' diff --git a/sos/report/plugins/kernel.py b/sos/report/plugins/kernel.py index 2ea6f318..febe2ad0 100644 --- a/sos/report/plugins/kernel.py +++ b/sos/report/plugins/kernel.py @@ -6,13 +6,12 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin, - UbuntuPlugin, CosPlugin) +from sos.report.plugins import Plugin, IndependentPlugin import os import glob -class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, CosPlugin): +class Kernel(Plugin, IndependentPlugin): short_desc = 'Linux kernel' diff --git a/sos/report/plugins/libraries.py b/sos/report/plugins/libraries.py index ed52ad2b..00687580 100644 --- a/sos/report/plugins/libraries.py +++ b/sos/report/plugins/libraries.py @@ -6,10 +6,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class Libraries(Plugin, RedHatPlugin, UbuntuPlugin): +class Libraries(Plugin, IndependentPlugin): short_desc = 'Dynamic shared libraries' diff --git a/sos/report/plugins/logs.py b/sos/report/plugins/logs.py index 5aeee9b0..06bd605a 100644 --- a/sos/report/plugins/logs.py +++ b/sos/report/plugins/logs.py @@ -8,11 +8,10 @@ import os import glob -from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin, - UbuntuPlugin, CosPlugin) +from sos.report.plugins import Plugin, IndependentPlugin -class Logs(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, CosPlugin): +class Logs(Plugin, IndependentPlugin): short_desc = 'System logs' diff --git a/sos/report/plugins/memory.py b/sos/report/plugins/memory.py index b358e44d..00ef9f05 100644 --- a/sos/report/plugins/memory.py +++ b/sos/report/plugins/memory.py @@ -6,11 +6,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin, - UbuntuPlugin, CosPlugin) +from sos.report.plugins import Plugin, IndependentPlugin -class Memory(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, CosPlugin): +class Memory(Plugin, IndependentPlugin): short_desc = 'Memory configuration and use' diff --git a/sos/report/plugins/nvidia.py b/sos/report/plugins/nvidia.py index 65f08270..d7fffbcc 100644 --- a/sos/report/plugins/nvidia.py +++ b/sos/report/plugins/nvidia.py @@ -9,10 +9,10 @@ # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class Nvidia(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): +class Nvidia(Plugin, IndependentPlugin): short_desc = 'Nvidia GPU information' diff --git a/sos/report/plugins/opencl.py b/sos/report/plugins/opencl.py index 0a2f721b..5160c5ca 100644 --- a/sos/report/plugins/opencl.py +++ b/sos/report/plugins/opencl.py @@ -6,10 +6,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class OpenCL(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): +class OpenCL(Plugin, IndependentPlugin): short_desc = 'OpenCL' diff --git a/sos/report/plugins/opengl.py b/sos/report/plugins/opengl.py index 3ba49c6a..57a48d72 100644 --- a/sos/report/plugins/opengl.py +++ b/sos/report/plugins/opengl.py @@ -6,10 +6,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class OpenGL(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): +class OpenGL(Plugin, IndependentPlugin): short_desc = 'OpenGL' diff --git a/sos/report/plugins/pci.py b/sos/report/plugins/pci.py index cd3da9bc..4304bf85 100644 --- a/sos/report/plugins/pci.py +++ b/sos/report/plugins/pci.py @@ -6,11 +6,11 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin +from sos.report.plugins import Plugin, IndependentPlugin import os -class Pci(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin): +class Pci(Plugin, IndependentPlugin): short_desc = 'PCI devices' diff --git a/sos/report/plugins/process.py b/sos/report/plugins/process.py index 6b79be3d..be2829a5 100644 --- a/sos/report/plugins/process.py +++ b/sos/report/plugins/process.py @@ -6,11 +6,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin, - UbuntuPlugin, CosPlugin) +from sos.report.plugins import Plugin, IndependentPlugin -class Process(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, CosPlugin): +class Process(Plugin, IndependentPlugin): short_desc = 'process information' diff --git a/sos/report/plugins/processor.py b/sos/report/plugins/processor.py index f0b68c82..28f5cdef 100644 --- a/sos/report/plugins/processor.py +++ b/sos/report/plugins/processor.py @@ -6,10 +6,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class Processor(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin): +class Processor(Plugin, IndependentPlugin): short_desc = 'CPU information' diff --git a/sos/report/plugins/system.py b/sos/report/plugins/system.py index 2fd57da1..a8e12ed7 100644 --- a/sos/report/plugins/system.py +++ b/sos/report/plugins/system.py @@ -6,10 +6,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class System(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): +class System(Plugin, IndependentPlugin): short_desc = 'core system information' diff --git a/sos/report/plugins/vulkan.py b/sos/report/plugins/vulkan.py index 8961b33d..8393a470 100644 --- a/sos/report/plugins/vulkan.py +++ b/sos/report/plugins/vulkan.py @@ -6,10 +6,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class Vulkan(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): +class Vulkan(Plugin, IndependentPlugin): short_desc = 'Vulkan' diff --git a/sos/report/plugins/x11.py b/sos/report/plugins/x11.py index 8cbb5de0..5b966f41 100644 --- a/sos/report/plugins/x11.py +++ b/sos/report/plugins/x11.py @@ -6,10 +6,10 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +from sos.report.plugins import Plugin, IndependentPlugin -class X11(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): +class X11(Plugin, IndependentPlugin): short_desc = 'X windowing system' |