From ec9f5676082d7b63c8a2b46ad3780e28f4786cca Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Wed, 11 Aug 2021 23:05:31 -0400 Subject: [plugins] Update existing plugin options to new class Updates all existing plugin options to use the new `PluginOpt` class introduced in the previous commit. Signed-off-by: Jake Hunsaker --- sos/report/plugins/abrt.py | 5 +++-- sos/report/plugins/apache.py | 5 +++-- sos/report/plugins/atomichost.py | 5 +++-- sos/report/plugins/boot.py | 5 +++-- sos/report/plugins/conntrack.py | 6 +++--- sos/report/plugins/containers_common.py | 6 +++--- sos/report/plugins/crio.py | 11 ++++++----- sos/report/plugins/dlm.py | 4 ++-- sos/report/plugins/dmraid.py | 4 ++-- sos/report/plugins/dnf.py | 8 +++++--- sos/report/plugins/docker.py | 13 +++++++------ sos/report/plugins/ebpf.py | 6 +++--- sos/report/plugins/fibrechannel.py | 4 ++-- sos/report/plugins/filesys.py | 10 ++++++---- sos/report/plugins/foreman.py | 8 +++++--- sos/report/plugins/gfs2.py | 7 +++---- sos/report/plugins/gluster.py | 6 ++++-- sos/report/plugins/jars.py | 9 +++++---- sos/report/plugins/kernel.py | 8 +++++--- sos/report/plugins/kubernetes.py | 17 +++++++++-------- sos/report/plugins/libraries.py | 5 +++-- sos/report/plugins/libreswan.py | 7 ++++--- sos/report/plugins/lvm2.py | 13 ++++++++----- sos/report/plugins/maas.py | 13 +++++++------ sos/report/plugins/monit.py | 2 -- sos/report/plugins/mssql.py | 6 +++--- sos/report/plugins/mysql.py | 11 +++++++---- sos/report/plugins/navicli.py | 8 +++++--- sos/report/plugins/networking.py | 26 ++++++++++++++------------ sos/report/plugins/nginx.py | 4 ++-- sos/report/plugins/npm.py | 10 +++++----- sos/report/plugins/openshift.py | 26 ++++++++++++++------------ sos/report/plugins/openstack_ceilometer.py | 2 -- sos/report/plugins/openstack_database.py | 6 +++--- sos/report/plugins/openstack_glance.py | 1 - sos/report/plugins/openstack_heat.py | 2 -- sos/report/plugins/openstack_horizon.py | 1 - sos/report/plugins/openstack_keystone.py | 8 ++++++-- sos/report/plugins/openstack_manila.py | 2 -- sos/report/plugins/openstack_sahara.py | 2 -- sos/report/plugins/openstack_swift.py | 2 -- sos/report/plugins/openstack_trove.py | 2 -- sos/report/plugins/origin.py | 14 +++++++------- sos/report/plugins/ovirt.py | 14 +++++++------- sos/report/plugins/ovirt_engine_backup.py | 10 +++++----- sos/report/plugins/pacemaker.py | 9 ++++++--- sos/report/plugins/pcp.py | 8 +++++--- sos/report/plugins/podman.py | 13 +++++++------ sos/report/plugins/postgresql.py | 21 ++++++++++++++------- sos/report/plugins/process.py | 17 +++++++++-------- sos/report/plugins/psacct.py | 8 +++++--- sos/report/plugins/pulp.py | 5 +++-- sos/report/plugins/pulpcore.py | 4 ++-- sos/report/plugins/pxe.py | 9 ++++++--- sos/report/plugins/python.py | 8 +++++--- sos/report/plugins/qpid.py | 17 ++++++++++------- sos/report/plugins/qpid_dispatch.py | 18 +++++++++++------- sos/report/plugins/rpm.py | 12 +++++++----- sos/report/plugins/sar.py | 9 ++++++--- sos/report/plugins/selinux.py | 8 +++++--- sos/report/plugins/services.py | 9 ++++++--- sos/report/plugins/skydive.py | 11 +++++++---- sos/report/plugins/smclient.py | 4 ++-- sos/report/plugins/storcli.py | 4 ++-- sos/report/plugins/veritas.py | 8 +++++--- sos/report/plugins/watchdog.py | 5 +++-- sos/report/plugins/yum.py | 9 +++++---- 67 files changed, 313 insertions(+), 247 deletions(-) diff --git a/sos/report/plugins/abrt.py b/sos/report/plugins/abrt.py index 70c93286..65977c77 100644 --- a/sos/report/plugins/abrt.py +++ b/sos/report/plugins/abrt.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class Abrt(Plugin, RedHatPlugin): @@ -21,7 +21,8 @@ class Abrt(Plugin, RedHatPlugin): files = ('/var/spool/abrt',) option_list = [ - ("detailed", 'collect detailed info for every report', 'slow', False) + PluginOpt("detailed", default=False, + desc="collect detailed information for every report") ] def setup(self): diff --git a/sos/report/plugins/apache.py b/sos/report/plugins/apache.py index 33e94132..f77117a1 100644 --- a/sos/report/plugins/apache.py +++ b/sos/report/plugins/apache.py @@ -6,7 +6,8 @@ # # 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, RedHatPlugin, DebianPlugin, + UbuntuPlugin, PluginOpt) class Apache(Plugin): @@ -18,7 +19,7 @@ class Apache(Plugin): files = ('/var/www/',) option_list = [ - ("log", "gathers all apache logs", "slow", False) + PluginOpt(name="log", default=False, desc="gathers all apache logs") ] def setup(self): diff --git a/sos/report/plugins/atomichost.py b/sos/report/plugins/atomichost.py index 8308358c..8a7b5c55 100644 --- a/sos/report/plugins/atomichost.py +++ b/sos/report/plugins/atomichost.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class AtomicHost(Plugin, RedHatPlugin): @@ -18,7 +18,8 @@ class AtomicHost(Plugin, RedHatPlugin): plugin_name = "atomichost" profiles = ('container',) option_list = [ - ("info", "gather atomic info for each image", "fast", False) + PluginOpt("info", default=False, + desc="gather atomic info for each image") ] def check_enabled(self): diff --git a/sos/report/plugins/boot.py b/sos/report/plugins/boot.py index 0fd7cbc3..81fccf17 100644 --- a/sos/report/plugins/boot.py +++ b/sos/report/plugins/boot.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt from glob import glob @@ -19,7 +19,8 @@ class Boot(Plugin, IndependentPlugin): packages = ('grub', 'grub2', 'grub-common', 'grub2-common', 'zipl') option_list = [ - ("all-images", "collect lsinitrd for all images", "slow", False) + PluginOpt("all-images", default=False, + desc="collect lsinitrd for all images") ] def setup(self): diff --git a/sos/report/plugins/conntrack.py b/sos/report/plugins/conntrack.py index 3403ea4c..608cc335 100644 --- a/sos/report/plugins/conntrack.py +++ b/sos/report/plugins/conntrack.py @@ -7,7 +7,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt class Conntrack(Plugin, IndependentPlugin): @@ -19,8 +19,8 @@ class Conntrack(Plugin, IndependentPlugin): packages = ('conntrack-tools', 'conntrack', 'conntrackd') option_list = [ - ('namespaces', 'Number of namespaces to collect, 0 for unlimited', - 'slow', None) + PluginOpt("namespaces", default=None, val_type=int, + desc="Number of namespaces to collect, 0 for unlimited"), ] def setup(self): diff --git a/sos/report/plugins/containers_common.py b/sos/report/plugins/containers_common.py index 4bc1ec6c..bd45ba12 100644 --- a/sos/report/plugins/containers_common.py +++ b/sos/report/plugins/containers_common.py @@ -8,7 +8,7 @@ # # 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, RedHatPlugin, UbuntuPlugin, PluginOpt import os @@ -19,8 +19,8 @@ class ContainersCommon(Plugin, RedHatPlugin, UbuntuPlugin): profiles = ('container', ) packages = ('containers-common', ) option_list = [ - ('rootlessusers', 'colon-separated list of users\' containers info', - '', ''), + PluginOpt('rootlessusers', default='', val_type=str, + desc='colon-delimited list of users to collect for') ] def setup(self): diff --git a/sos/report/plugins/crio.py b/sos/report/plugins/crio.py index c256404b..cb2c9796 100644 --- a/sos/report/plugins/crio.py +++ b/sos/report/plugins/crio.py @@ -8,7 +8,8 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin, SoSPredicate +from sos.report.plugins import (Plugin, RedHatPlugin, UbuntuPlugin, + SoSPredicate, PluginOpt) class CRIO(Plugin, RedHatPlugin, UbuntuPlugin): @@ -20,10 +21,10 @@ class CRIO(Plugin, RedHatPlugin, UbuntuPlugin): services = ('crio',) option_list = [ - ("all", "enable capture for all containers, even containers " - "that have terminated", 'fast', False), - ("logs", "capture logs for running containers", - 'fast', False), + PluginOpt('all', default=False, + desc='collect for all containers, even terminated ones'), + PluginOpt('logs', default=False, + desc='collect stdout/stderr logs for containers') ] def setup(self): diff --git a/sos/report/plugins/dlm.py b/sos/report/plugins/dlm.py index 8f8e08b0..b34b5b74 100644 --- a/sos/report/plugins/dlm.py +++ b/sos/report/plugins/dlm.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt import re @@ -18,7 +18,7 @@ class Dlm(Plugin, IndependentPlugin): profiles = ("cluster", ) packages = ("cman", "dlm", "pacemaker") option_list = [ - ("lockdump", "capture lock dumps for DLM", "slow", False), + PluginOpt('lockdump', default=False, desc='capture lock dumps for DLM') ] def setup(self): diff --git a/sos/report/plugins/dmraid.py b/sos/report/plugins/dmraid.py index f655350e..54fba644 100644 --- a/sos/report/plugins/dmraid.py +++ b/sos/report/plugins/dmraid.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt class Dmraid(Plugin, IndependentPlugin): @@ -18,7 +18,7 @@ class Dmraid(Plugin, IndependentPlugin): packages = ('dmraid',) option_list = [ - ("metadata", "capture dmraid device metadata", "slow", False) + PluginOpt('metadata', default=False, desc='collect dmraid metadata') ] # V - {-V/--version} diff --git a/sos/report/plugins/dnf.py b/sos/report/plugins/dnf.py index 6aecc655..9725e0da 100644 --- a/sos/report/plugins/dnf.py +++ b/sos/report/plugins/dnf.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class DNFPlugin(Plugin, RedHatPlugin): @@ -21,8 +21,10 @@ class DNFPlugin(Plugin, RedHatPlugin): packages = ('dnf',) option_list = [ - ("history", "captures transaction history", "fast", False), - ("history-info", "detailed transaction history", "slow", False), + PluginOpt('history', default=False, + desc='collect transaction history'), + PluginOpt('history-info', default=False, + desc='collect detailed transaction history') ] def get_modules_info(self, modules): diff --git a/sos/report/plugins/docker.py b/sos/report/plugins/docker.py index ac86ae3f..bb569b3b 100644 --- a/sos/report/plugins/docker.py +++ b/sos/report/plugins/docker.py @@ -9,7 +9,7 @@ # See the LICENSE file in the source distribution for further information. from sos.report.plugins import (Plugin, RedHatPlugin, UbuntuPlugin, - SoSPredicate, CosPlugin) + SoSPredicate, CosPlugin, PluginOpt) class Docker(Plugin, CosPlugin): @@ -19,11 +19,12 @@ class Docker(Plugin, CosPlugin): profiles = ('container',) option_list = [ - ("all", "enable capture for all containers, even containers " - "that have terminated", 'fast', False), - ("logs", "capture logs for running containers", - 'fast', False), - ("size", "capture image sizes for docker ps", 'slow', False) + PluginOpt('all', default=False, + desc='collect for all containers, even terminated ones'), + PluginOpt('logs', default=False, + desc='collect stdout/stderr logs for containers'), + PluginOpt('size', default=False, + desc='collect image sizes for docker ps') ] def setup(self): diff --git a/sos/report/plugins/ebpf.py b/sos/report/plugins/ebpf.py index 22966e8e..6c5f7dee 100644 --- a/sos/report/plugins/ebpf.py +++ b/sos/report/plugins/ebpf.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt import json @@ -17,8 +17,8 @@ class Ebpf(Plugin, IndependentPlugin): profiles = ('system', 'kernel', 'network') option_list = [ - ('namespaces', 'Number of namespaces to collect, 0 for unlimited', - 'slow', None) + PluginOpt("namespaces", default=None, val_type=int, + desc="Number of namespaces to collect, 0 for unlimited"), ] def get_bpftool_prog_ids(self, prog_json): diff --git a/sos/report/plugins/fibrechannel.py b/sos/report/plugins/fibrechannel.py index fc871e0d..b1356c3c 100644 --- a/sos/report/plugins/fibrechannel.py +++ b/sos/report/plugins/fibrechannel.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class Fibrechannel(Plugin, RedHatPlugin): @@ -19,7 +19,7 @@ class Fibrechannel(Plugin, RedHatPlugin): profiles = ('hardware', 'storage', 'system') files = ('/sys/class/fc_host', '/sys/class/fc_remote_ports') option_list = [ - ("debug", "enable debug logs", "fast", True) + PluginOpt('debug', default=True, desc='collect debugging logs') ] # vendor specific debug paths diff --git a/sos/report/plugins/filesys.py b/sos/report/plugins/filesys.py index e802e5eb..01495603 100644 --- a/sos/report/plugins/filesys.py +++ b/sos/report/plugins/filesys.py @@ -7,7 +7,7 @@ # See the LICENSE file in the source distribution for further information. from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin, - UbuntuPlugin, CosPlugin) + UbuntuPlugin, CosPlugin, PluginOpt) class Filesys(Plugin, DebianPlugin, UbuntuPlugin, CosPlugin): @@ -18,9 +18,11 @@ class Filesys(Plugin, DebianPlugin, UbuntuPlugin, CosPlugin): profiles = ('storage',) option_list = [ - ("lsof", 'gathers information on all open files', 'slow', False), - ("dumpe2fs", 'dump filesystem information', 'slow', False), - ("frag", 'filesystem fragmentation status', 'slow', False) + PluginOpt('lsof', default=False, + desc='collect information on all open files'), + PluginOpt('dumpe2fs', default=False, desc='dump filesystem info'), + PluginOpt('frag', default=False, + desc='collect filesystem fragmentation status') ] def setup(self): diff --git a/sos/report/plugins/foreman.py b/sos/report/plugins/foreman.py index 52fdd9fe..a3d2827d 100644 --- a/sos/report/plugins/foreman.py +++ b/sos/report/plugins/foreman.py @@ -10,7 +10,7 @@ # See the LICENSE file in the source distribution for further information. from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin, - UbuntuPlugin) + UbuntuPlugin, PluginOpt) from pipes import quote from re import match @@ -24,8 +24,10 @@ class Foreman(Plugin): profiles = ('sysmgmt',) packages = ('foreman',) option_list = [ - ('months', 'number of months for dynflow output', 'fast', 1), - ('proxyfeatures', 'collect features of smart proxies', 'slow', False), + PluginOpt('months', default=1, + desc='number of months for dynflow output'), + PluginOpt('proxyfeatures', default=False, + desc='collect features of smart proxies') ] def setup(self): diff --git a/sos/report/plugins/gfs2.py b/sos/report/plugins/gfs2.py index cce6198c..4a455297 100644 --- a/sos/report/plugins/gfs2.py +++ b/sos/report/plugins/gfs2.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt class Gfs2(Plugin, IndependentPlugin): @@ -18,9 +18,8 @@ class Gfs2(Plugin, IndependentPlugin): packages = ("gfs2-utils",) option_list = [ - ("lockdump", - "capture lock dumps for all GFS2 filesystems", - "slow", False), + PluginOpt('lockdump', default=False, + desc='collect lock dumps for all GFS2 filesystems') ] def setup(self): diff --git a/sos/report/plugins/gluster.py b/sos/report/plugins/gluster.py index 6886d14a..a44ffeb7 100644 --- a/sos/report/plugins/gluster.py +++ b/sos/report/plugins/gluster.py @@ -10,7 +10,7 @@ import time import os import glob import string -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class Gluster(Plugin, RedHatPlugin): @@ -24,7 +24,9 @@ class Gluster(Plugin, RedHatPlugin): packages = ("glusterfs", "glusterfs-core") files = ("/etc/glusterd", "/var/lib/glusterd") - option_list = [("dump", "enable glusterdump support", "slow", False)] + option_list = [ + PluginOpt("dump", default=False, desc="enable glusterdump support") + ] def wait_for_statedump(self, name_dir): statedumps_present = 0 diff --git a/sos/report/plugins/jars.py b/sos/report/plugins/jars.py index 0bf431b2..f2a26679 100644 --- a/sos/report/plugins/jars.py +++ b/sos/report/plugins/jars.py @@ -14,7 +14,7 @@ import os import re import zipfile from functools import partial -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class Jars(Plugin, RedHatPlugin): @@ -24,9 +24,10 @@ class Jars(Plugin, RedHatPlugin): plugin_name = "jars" profiles = ("java",) option_list = [ - ("append_locations", "colon-separated list of additional JAR paths", - "fast", ""), - ("all_known_locations", "scan all known paths", "slow", False) + PluginOpt('append_locations', default="", val_type=str, + desc='colon-delimited list of additional JAR paths'), + PluginOpt('all_known_locations', default=False, + desc='scan all known paths') ] # There is no standard location for JAR files and scanning diff --git a/sos/report/plugins/kernel.py b/sos/report/plugins/kernel.py index b9277c3b..8c5e5e11 100644 --- a/sos/report/plugins/kernel.py +++ b/sos/report/plugins/kernel.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt import glob @@ -21,8 +21,10 @@ class Kernel(Plugin, IndependentPlugin): sys_module = '/sys/module' option_list = [ - ("with-timer", "gather /proc/timer* statistics", "slow", False), - ("trace", "gather /sys/kernel/debug/tracing/trace file", "slow", False) + PluginOpt('with-timer', default=False, + desc='gather /proc/timer* statistics'), + PluginOpt('trace', default=False, + desc='gather /sys/kernel/debug/tracing/trace file') ] def setup(self): diff --git a/sos/report/plugins/kubernetes.py b/sos/report/plugins/kubernetes.py index eaa5dbc3..5cd416c5 100644 --- a/sos/report/plugins/kubernetes.py +++ b/sos/report/plugins/kubernetes.py @@ -9,7 +9,7 @@ # # 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, RedHatPlugin, UbuntuPlugin, PluginOpt from fnmatch import translate import re @@ -22,13 +22,14 @@ class Kubernetes(Plugin): profiles = ('container',) option_list = [ - ("all", "also collect all namespaces output separately", - 'slow', False), - ("describe", "capture descriptions of all kube resources", - 'fast', False), - ("podlogs", "capture logs for pods", 'slow', False), - ("podlogs-filter", "only capture logs for pods matching this string", - 'fast', '') + PluginOpt('all', default=False, + desc='collect all namespace output separately'), + PluginOpt('describe', default=False, + desc='collect describe output of all resources'), + PluginOpt('podlogs', default=False, + desc='capture stdout/stderr logs from pods'), + PluginOpt('podlogs-filter', default='', val_type=str, + desc='only collect logs from pods matching this pattern') ] kube_cmd = "kubectl" diff --git a/sos/report/plugins/libraries.py b/sos/report/plugins/libraries.py index 00687580..206cdfb6 100644 --- a/sos/report/plugins/libraries.py +++ b/sos/report/plugins/libraries.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt class Libraries(Plugin, IndependentPlugin): @@ -17,7 +17,8 @@ class Libraries(Plugin, IndependentPlugin): profiles = ('system',) option_list = [ - ('ldconfigv', 'collect verbose ldconfig output', "slow", False) + PluginOpt('ldconfigv', default=False, + desc='collect verbose ldconfig output') ] def setup(self): diff --git a/sos/report/plugins/libreswan.py b/sos/report/plugins/libreswan.py index cf815bde..38037525 100644 --- a/sos/report/plugins/libreswan.py +++ b/sos/report/plugins/libreswan.py @@ -9,7 +9,8 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin, SoSPredicate +from sos.report.plugins import (Plugin, IndependentPlugin, SoSPredicate, + PluginOpt) class Libreswan(Plugin, IndependentPlugin): @@ -19,8 +20,8 @@ class Libreswan(Plugin, IndependentPlugin): plugin_name = 'libreswan' profiles = ('network', 'security', 'openshift') option_list = [ - ("ipsec-barf", "collect the output of the ipsec barf command", - "slow", False) + PluginOpt('ipsec-barf', default=False, + desc='collect ipsec barf output') ] files = ('/etc/ipsec.conf',) diff --git a/sos/report/plugins/lvm2.py b/sos/report/plugins/lvm2.py index 9ec0017f..28ca6685 100644 --- a/sos/report/plugins/lvm2.py +++ b/sos/report/plugins/lvm2.py @@ -6,7 +6,8 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin, SoSPredicate +from sos.report.plugins import (Plugin, IndependentPlugin, SoSPredicate, + PluginOpt) class Lvm2(Plugin, IndependentPlugin): @@ -16,10 +17,12 @@ class Lvm2(Plugin, IndependentPlugin): plugin_name = 'lvm2' profiles = ('storage',) - option_list = [("lvmdump", 'collect an lvmdump tarball', 'fast', False), - ("lvmdump-am", 'attempt to collect an lvmdump with ' - 'advanced options and raw metadata collection', 'slow', - False)] + option_list = [ + PluginOpt('lvmdump', default=False, desc='collect an lvmdump tarball'), + PluginOpt('lvmdump-am', default=False, + desc=('attempt to collect lvmdump with advanced options and ' + 'raw metadata')) + ] def do_lvmdump(self, metadata=False): """Collects an lvmdump in standard format with optional metadata diff --git a/sos/report/plugins/maas.py b/sos/report/plugins/maas.py index f4e3662e..adea22c3 100644 --- a/sos/report/plugins/maas.py +++ b/sos/report/plugins/maas.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, UbuntuPlugin +from sos.report.plugins import Plugin, UbuntuPlugin, PluginOpt class Maas(Plugin, UbuntuPlugin): @@ -33,11 +33,12 @@ class Maas(Plugin, UbuntuPlugin): ) option_list = [ - ('profile-name', - 'The name with which you will later refer to this remote', '', ''), - ('url', 'The URL of the remote API', '', ''), - ('credentials', - 'The credentials, also known as the API key', '', '') + PluginOpt('profile-name', default='', val_type=str, + desc='Name of the remote API'), + PluginOpt('url', default='', val_type=str, + desc='URL of the remote API'), + PluginOpt('credentials', default='', val_type=str, + desc='Credentials, or the API key') ] def _has_login_options(self): diff --git a/sos/report/plugins/monit.py b/sos/report/plugins/monit.py index 70632679..3dcabc93 100644 --- a/sos/report/plugins/monit.py +++ b/sos/report/plugins/monit.py @@ -29,8 +29,6 @@ class Monit(Plugin, RedHatPlugin): # Define log files monit_log = ["/var/log/monit.log"] - option_list = [] - def setup(self): self.add_cmd_output("monit status") self.add_copy_spec(self.monit_log + self.monit_conf) diff --git a/sos/report/plugins/mssql.py b/sos/report/plugins/mssql.py index f1bfe9fa..d9dce0f9 100644 --- a/sos/report/plugins/mssql.py +++ b/sos/report/plugins/mssql.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class MsSQL(Plugin, RedHatPlugin): @@ -20,8 +20,8 @@ class MsSQL(Plugin, RedHatPlugin): packages = ('mssql-server',) option_list = [ - ('mssql_conf', 'SQL Server configuration file.', '', - '/var/opt/mssql/mssql.conf') + PluginOpt('mssql_conf', default='/var/opt/mssql/mssql.conf', + desc='SQL server configuration file') ] def setup(self): diff --git a/sos/report/plugins/mysql.py b/sos/report/plugins/mysql.py index 72e5c653..17de358d 100644 --- a/sos/report/plugins/mysql.py +++ b/sos/report/plugins/mysql.py @@ -6,7 +6,8 @@ # # 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, RedHatPlugin, DebianPlugin, + UbuntuPlugin, PluginOpt) import os @@ -21,9 +22,11 @@ class Mysql(Plugin): pw_warn_text = " (password visible in process listings)" option_list = [ - ("dbuser", "username for database dumps", "", "mysql"), - ("dbpass", "password for database dumps" + pw_warn_text, "", ""), - ("dbdump", "collect a database dump", "", False) + PluginOpt('dbuser', default='mysql', val_type=str, + desc='username for database dump collection'), + PluginOpt('dbpass', default='', val_type=str, + desc='password for data dump collection' + pw_warn_text), + PluginOpt('dbdump', default=False, desc='Collect a database dump') ] def setup(self): diff --git a/sos/report/plugins/navicli.py b/sos/report/plugins/navicli.py index eb244890..6e258568 100644 --- a/sos/report/plugins/navicli.py +++ b/sos/report/plugins/navicli.py @@ -9,7 +9,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt from sos.utilities import is_executable @@ -19,8 +19,10 @@ class Navicli(Plugin, RedHatPlugin): plugin_name = 'navicli' profiles = ('storage', 'hardware') - option_list = [("ipaddrs", "list of space separated CLARiiON IP addresses", - '', "")] + option_list = [ + PluginOpt('ipaddrs', default='', val_type=str, + desc='space-delimited list of CLARiiON IP addresses') + ] def check_enabled(self): return is_executable("navicli") diff --git a/sos/report/plugins/networking.py b/sos/report/plugins/networking.py index ae6cf0a1..c80ae719 100644 --- a/sos/report/plugins/networking.py +++ b/sos/report/plugins/networking.py @@ -7,7 +7,7 @@ # See the LICENSE file in the source distribution for further information. from sos.report.plugins import (Plugin, RedHatPlugin, UbuntuPlugin, - DebianPlugin, SoSPredicate) + DebianPlugin, SoSPredicate, PluginOpt) class Networking(Plugin): @@ -17,17 +17,20 @@ class Networking(Plugin): plugin_name = "networking" profiles = ('network', 'hardware', 'system') trace_host = "www.example.com" + option_list = [ - ("traceroute", "collect a traceroute to %s" % trace_host, "slow", - False), - ("namespace_pattern", "Specific namespaces pattern to be " + - "collected, namespaces pattern should be separated by whitespace " + - "as for example \"eth* ens2\"", "fast", ""), - ("namespaces", "Number of namespaces to collect, 0 for unlimited. " + - "Incompatible with the namespace_pattern option", "slow", None), - ("ethtool_namespaces", "Define if ethtool commands should be " + - "collected for namespaces", "slow", True), - ("eepromdump", "collect 'ethtool -e' for all devices", "slow", False) + PluginOpt("traceroute", default=False, + desc="collect a traceroute to %s" % trace_host), + PluginOpt("namespace_pattern", default="", val_type=str, + desc=("Specific namespace names or patterns to collect, " + "whitespace delimited.")), + PluginOpt("namespaces", default=None, val_type=int, + desc="Number of namespaces to collect, 0 for unlimited"), + PluginOpt("ethtool_namespaces", default=True, + desc=("Toggle if ethtool commands should be run for each " + "namespace")), + PluginOpt("eepromdump", default=False, + desc="Toggle collection of 'ethtool -e' for NICs") ] # switch to enable netstat "wide" (non-truncated) output mode @@ -39,7 +42,6 @@ class Networking(Plugin): def setup(self): super(Networking, self).setup() - for opt in self.ethtool_shortopts: self.add_cmd_tags({ 'ethtool -%s .*' % opt: 'ethool_%s' % opt diff --git a/sos/report/plugins/nginx.py b/sos/report/plugins/nginx.py index 75c937b6..204498df 100644 --- a/sos/report/plugins/nginx.py +++ b/sos/report/plugins/nginx.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt class Nginx(Plugin, IndependentPlugin): @@ -17,7 +17,7 @@ class Nginx(Plugin, IndependentPlugin): packages = ('nginx',) option_list = [ - ("log", "gathers all nginx logs", "slow", False) + PluginOpt('log', default=False, desc='collect all nginx logs') ] def setup(self): diff --git a/sos/report/plugins/npm.py b/sos/report/plugins/npm.py index c2068bac..78f80c91 100644 --- a/sos/report/plugins/npm.py +++ b/sos/report/plugins/npm.py @@ -9,7 +9,7 @@ # See the LICENSE file in the source distribution for further information. import os -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt class Npm(Plugin, IndependentPlugin): @@ -17,10 +17,10 @@ class Npm(Plugin, IndependentPlugin): short_desc = 'Information from available npm modules' plugin_name = 'npm' profiles = ('system',) - option_list = [("project_path", - 'List npm modules of a project specified by path', - 'fast', - '')] + option_list = [ + PluginOpt('project_path', default='', val_type=str, + desc='Collect npm modules of project at this path') + ] # in Fedora, Debian, Ubuntu and Suse the package is called npm packages = ('npm',) diff --git a/sos/report/plugins/openshift.py b/sos/report/plugins/openshift.py index ef5afdc0..5ae38178 100644 --- a/sos/report/plugins/openshift.py +++ b/sos/report/plugins/openshift.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt from fnmatch import translate import os import re @@ -54,17 +54,19 @@ class Openshift(Plugin, RedHatPlugin): packages = ('openshift-hyperkube',) option_list = [ - ('token', 'admin token to allow API queries', 'fast', None), - ('host', 'host address to use for oc login, including port', 'fast', - 'https://localhost:6443'), - ('no-oc', 'do not collect `oc` command output', 'fast', False), - ('podlogs', 'collect logs from each pod', 'fast', True), - ('podlogs-filter', ('limit podlogs collection to pods matching this ' - 'regex'), 'fast', ''), - ('only-namespaces', 'colon-delimited list of namespaces to collect', - 'fast', ''), - ('add-namespaces', ('colon-delimited list of namespaces to add to the ' - 'default collections'), 'fast', '') + PluginOpt('token', default=None, val_type=str, + desc='admin token to allow API queries'), + PluginOpt('host', default='https://localhost:6443', + desc='host address to use for oc login, including port'), + PluginOpt('no-oc', default=False, desc='do not collect `oc` output'), + PluginOpt('podlogs', default=True, desc='collect logs from each pod'), + PluginOpt('podlogs-filter', default='', val_type=str, + desc='only collect logs from pods matching this pattern'), + PluginOpt('only-namespaces', default='', val_type=str, + desc='colon-delimited list of namespaces to collect from'), + PluginOpt('add-namespaces', default='', val_type=str, + desc=('colon-delimited list of namespaces to add to the ' + 'default collection list')) ] def _check_oc_function(self): diff --git a/sos/report/plugins/openstack_ceilometer.py b/sos/report/plugins/openstack_ceilometer.py index c9e38db6..cbedeadd 100644 --- a/sos/report/plugins/openstack_ceilometer.py +++ b/sos/report/plugins/openstack_ceilometer.py @@ -20,8 +20,6 @@ class OpenStackCeilometer(Plugin): short_desc = 'Openstack Ceilometer' plugin_name = "openstack_ceilometer" profiles = ('openstack', 'openstack_controller', 'openstack_compute') - - option_list = [] var_puppet_gen = "/var/lib/config-data/puppet-generated/ceilometer" def setup(self): diff --git a/sos/report/plugins/openstack_database.py b/sos/report/plugins/openstack_database.py index 25d3372a..1e98fabf 100644 --- a/sos/report/plugins/openstack_database.py +++ b/sos/report/plugins/openstack_database.py @@ -11,7 +11,7 @@ import re -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class OpenStackDatabase(Plugin): @@ -21,8 +21,8 @@ class OpenStackDatabase(Plugin): profiles = ('openstack', 'openstack_controller') option_list = [ - ('dump', 'Dump select databases to a SQL file', 'slow', False), - ('dumpall', 'Dump ALL databases to a SQL file', 'slow', False) + PluginOpt('dump', default=False, desc='Dump select databases'), + PluginOpt('dumpall', default=False, desc='Dump ALL databases') ] databases = [ diff --git a/sos/report/plugins/openstack_glance.py b/sos/report/plugins/openstack_glance.py index eb0f88e9..b3bc7d5e 100644 --- a/sos/report/plugins/openstack_glance.py +++ b/sos/report/plugins/openstack_glance.py @@ -23,7 +23,6 @@ class OpenStackGlance(Plugin): profiles = ('openstack', 'openstack_controller') containers = ('glance_api',) - option_list = [] var_puppet_gen = "/var/lib/config-data/puppet-generated/glance_api" service_name = "openstack-glance-api.service" diff --git a/sos/report/plugins/openstack_heat.py b/sos/report/plugins/openstack_heat.py index 3441f91d..0f1b019a 100644 --- a/sos/report/plugins/openstack_heat.py +++ b/sos/report/plugins/openstack_heat.py @@ -19,8 +19,6 @@ class OpenStackHeat(Plugin): plugin_name = "openstack_heat" profiles = ('openstack', 'openstack_controller') containers = ('.*heat_api',) - - option_list = [] var_puppet_gen = "/var/lib/config-data/puppet-generated/heat" service_name = "openstack-heat-api.service" diff --git a/sos/report/plugins/openstack_horizon.py b/sos/report/plugins/openstack_horizon.py index aabe9ad2..aaf884d8 100644 --- a/sos/report/plugins/openstack_horizon.py +++ b/sos/report/plugins/openstack_horizon.py @@ -20,7 +20,6 @@ class OpenStackHorizon(Plugin): plugin_name = "openstack_horizon" profiles = ('openstack', 'openstack_controller') - option_list = [] var_puppet_gen = "/var/lib/config-data/puppet-generated" def setup(self): diff --git a/sos/report/plugins/openstack_keystone.py b/sos/report/plugins/openstack_keystone.py index bf3de364..76b0178c 100644 --- a/sos/report/plugins/openstack_keystone.py +++ b/sos/report/plugins/openstack_keystone.py @@ -9,7 +9,8 @@ # # 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, RedHatPlugin, DebianPlugin, + UbuntuPlugin, PluginOpt) import os @@ -19,7 +20,10 @@ class OpenStackKeystone(Plugin): plugin_name = "openstack_keystone" profiles = ('openstack', 'openstack_controller') - option_list = [("nopw", "dont gathers keystone passwords", "slow", True)] + option_list = [ + PluginOpt('nopw', default=True, + desc='do not collect keystone passwords') + ] var_puppet_gen = "/var/lib/config-data/puppet-generated/keystone" def setup(self): diff --git a/sos/report/plugins/openstack_manila.py b/sos/report/plugins/openstack_manila.py index bf84e0ab..8184b634 100644 --- a/sos/report/plugins/openstack_manila.py +++ b/sos/report/plugins/openstack_manila.py @@ -17,8 +17,6 @@ class OpenStackManila(Plugin): plugin_name = "openstack_manila" profiles = ('openstack', 'openstack_controller') containers = ('.*manila_api',) - option_list = [] - var_puppet_gen = "/var/lib/config-data/puppet-generated/manila" def setup(self): diff --git a/sos/report/plugins/openstack_sahara.py b/sos/report/plugins/openstack_sahara.py index ec7e18f1..9d3beb9d 100644 --- a/sos/report/plugins/openstack_sahara.py +++ b/sos/report/plugins/openstack_sahara.py @@ -16,8 +16,6 @@ class OpenStackSahara(Plugin): short_desc = 'OpenStack Sahara' plugin_name = 'openstack_sahara' profiles = ('openstack', 'openstack_controller') - - option_list = [] var_puppet_gen = "/var/lib/config-data/puppet-generated/sahara" def setup(self): diff --git a/sos/report/plugins/openstack_swift.py b/sos/report/plugins/openstack_swift.py index 0abc117f..0ba1306a 100644 --- a/sos/report/plugins/openstack_swift.py +++ b/sos/report/plugins/openstack_swift.py @@ -20,8 +20,6 @@ class OpenStackSwift(Plugin): plugin_name = "openstack_swift" profiles = ('openstack', 'openstack_controller') - option_list = [] - var_puppet_gen = "/var/lib/config-data/puppet-generated" def setup(self): diff --git a/sos/report/plugins/openstack_trove.py b/sos/report/plugins/openstack_trove.py index 1e4a2fc3..debbd7a9 100644 --- a/sos/report/plugins/openstack_trove.py +++ b/sos/report/plugins/openstack_trove.py @@ -18,8 +18,6 @@ class OpenStackTrove(Plugin): plugin_name = "openstack_trove" profiles = ('openstack', 'openstack_controller') - option_list = [] - var_puppet_gen = "/var/lib/config-data/puppet-generated/trove" def setup(self): diff --git a/sos/report/plugins/origin.py b/sos/report/plugins/origin.py index 15c01b72..0b92fa0f 100644 --- a/sos/report/plugins/origin.py +++ b/sos/report/plugins/origin.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt import os.path # This plugin collects static configuration and runtime information @@ -41,12 +41,12 @@ class OpenShiftOrigin(Plugin): profiles = ('openshift',) option_list = [ - ("diag", "run 'oc adm diagnostics' to collect its output", - 'fast', True), - ("diag-prevent", "set --prevent-modification on 'oc adm diagnostics'", - 'fast', True), - ("all-namespaces", "collect dc output for all namespaces", "fast", - False) + PluginOpt('diag', default=True, + desc='Collect oc adm diagnostics output'), + PluginOpt('diag-prevent', default=True, + desc='Use --prevent-modification with oc adm diagnostics'), + PluginOpt('all-namespaces', default=False, + desc='collect dc output for all namespaces') ] master_base_dir = "/etc/origin/master" diff --git a/sos/report/plugins/ovirt.py b/sos/report/plugins/ovirt.py index 132d6c74..1de606be 100644 --- a/sos/report/plugins/ovirt.py +++ b/sos/report/plugins/ovirt.py @@ -16,7 +16,7 @@ import re import signal -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt from sos.utilities import is_executable @@ -55,12 +55,12 @@ class Ovirt(Plugin, RedHatPlugin): ) option_list = [ - ('jbosstrace', 'Enable oVirt Engine JBoss stack trace collection', - '', True), - ('sensitive_keys', 'Sensitive keys to be masked', - '', DEFAULT_SENSITIVE_KEYS), - ('heapdump', 'Collect heap dumps from /var/log/ovirt-engine/dump/', - '', False) + PluginOpt('jbosstrace', default=True, + desc='Enable oVirt Engine JBoss stack trace collection'), + PluginOpt('sensitive_keys', default=DEFAULT_SENSITIVE_KEYS, + desc='Sensitive keys to be masked in post-processing'), + PluginOpt('heapdump', default=False, + desc='Collect heap dumps from /var/log/ovirt-engine/dump/') ] def setup(self): diff --git a/sos/report/plugins/ovirt_engine_backup.py b/sos/report/plugins/ovirt_engine_backup.py index ada2afe6..676e419e 100644 --- a/sos/report/plugins/ovirt_engine_backup.py +++ b/sos/report/plugins/ovirt_engine_backup.py @@ -9,7 +9,7 @@ # See the LICENSE file in the source distribution for further information. import os -from sos.report.plugins import (Plugin, RedHatPlugin) +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt from datetime import datetime @@ -20,10 +20,10 @@ class oVirtEngineBackup(Plugin, RedHatPlugin): packages = ("ovirt-engine-tools-backup",) plugin_name = "ovirt_engine_backup" option_list = [ - ("backupdir", "Directory where the backup is generated", - "fast", "/var/lib/ovirt-engine-backup"), - ("tmpdir", "Directory where the intermediate files are generated", - "fast", '/tmp'), + PluginOpt('backupdir', default='/var/lib/ovirt-engine-backup', + desc='Directory where backups are generated'), + PluginOpt('tmpdir', default='/tmp', + desc='temp dir to use for engine-backup') ] profiles = ("virt",) diff --git a/sos/report/plugins/pacemaker.py b/sos/report/plugins/pacemaker.py index 8183abd7..497807ff 100644 --- a/sos/report/plugins/pacemaker.py +++ b/sos/report/plugins/pacemaker.py @@ -6,7 +6,8 @@ # # 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, RedHatPlugin, DebianPlugin, + UbuntuPlugin, PluginOpt) from datetime import datetime, timedelta import re @@ -23,8 +24,10 @@ class Pacemaker(Plugin): ) option_list = [ - ("crm_from", "specify the start time for crm_report", "fast", ''), - ("crm_scrub", "enable password scrubbing for crm_report", "", True), + PluginOpt('crm_from', default='', val_type=str, + desc='specfiy the start time for crm_report'), + PluginOpt('crm_scrub', default=True, + desc='enable crm_report password scrubbing') ] envfile = "" diff --git a/sos/report/plugins/pcp.py b/sos/report/plugins/pcp.py index 4948b714..9707d7a9 100644 --- a/sos/report/plugins/pcp.py +++ b/sos/report/plugins/pcp.py @@ -8,7 +8,7 @@ # # 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, RedHatPlugin, DebianPlugin, PluginOpt import os from socket import gethostname @@ -25,8 +25,10 @@ class Pcp(Plugin, RedHatPlugin, DebianPlugin): # size-limit of PCP logger and manager data collected by default (MB) option_list = [ - ("pmmgrlogs", "size-limit in MB of pmmgr logs", "", 100), - ("pmloggerfiles", "number of newest pmlogger files to grab", "", 12), + PluginOpt('pmmgrlogs', default=100, + desc='size limit in MB of pmmgr logs'), + PluginOpt('pmloggerfiles', default=12, + desc='number of pmlogger files to collect') ] pcp_sysconf_dir = None diff --git a/sos/report/plugins/podman.py b/sos/report/plugins/podman.py index feb9badf..ffc63834 100644 --- a/sos/report/plugins/podman.py +++ b/sos/report/plugins/podman.py @@ -8,7 +8,7 @@ # # 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, RedHatPlugin, UbuntuPlugin, PluginOpt class Podman(Plugin, RedHatPlugin, UbuntuPlugin): @@ -19,11 +19,12 @@ class Podman(Plugin, RedHatPlugin, UbuntuPlugin): packages = ('podman',) option_list = [ - ("all", "enable capture for all containers, even containers " - "that have terminated", 'fast', False), - ("logs", "capture logs for running containers", - 'fast', False), - ("size", "capture image sizes for podman ps", 'slow', False) + PluginOpt('all', default=False, + desc='collect for all containers, even terminated ones'), + PluginOpt('logs', default=False, + desc='collect stdout/stderr logs for containers'), + PluginOpt('size', default=False, + desc='collect image sizes for podman ps') ] def setup(self): diff --git a/sos/report/plugins/postgresql.py b/sos/report/plugins/postgresql.py index 72cf7b7e..bec0b019 100644 --- a/sos/report/plugins/postgresql.py +++ b/sos/report/plugins/postgresql.py @@ -14,7 +14,8 @@ import os -from sos.report.plugins import (Plugin, UbuntuPlugin, DebianPlugin, SCLPlugin) +from sos.report.plugins import (Plugin, UbuntuPlugin, DebianPlugin, SCLPlugin, + PluginOpt) from sos.utilities import find @@ -30,12 +31,18 @@ class PostgreSQL(Plugin): password_warn_text = " (password visible in process listings)" option_list = [ - ('pghome', 'PostgreSQL server home directory.', '', '/var/lib/pgsql'), - ('username', 'username for pg_dump', '', 'postgres'), - ('password', 'password for pg_dump' + password_warn_text, '', ''), - ('dbname', 'database name to dump for pg_dump', '', ''), - ('dbhost', 'database hostname/IP (do not use unix socket)', '', ''), - ('dbport', 'database server port number', '', '5432') + PluginOpt('pghome', default='/var/lib/pgsql', + desc='psql server home directory'), + PluginOpt('username', default='postgres', val_type=str, + desc='username for pg_dump'), + PluginOpt('password', default='', val_type=str, + desc='password for pg_dump' + password_warn_text), + PluginOpt('dbname', default='', val_type=str, + desc='database name to dump with pg_dump'), + PluginOpt('dbhost', default='', val_type=str, + desc='database hostname/IP address (no unix sockets)'), + PluginOpt('dbport', default=5432, val_type=[int, str], + desc='database server listening port') ] def do_pg_dump(self, scl=None, filename="pgdump.tar"): diff --git a/sos/report/plugins/process.py b/sos/report/plugins/process.py index 46091375..62705c4f 100644 --- a/sos/report/plugins/process.py +++ b/sos/report/plugins/process.py @@ -8,7 +8,7 @@ import re -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt class Process(Plugin, IndependentPlugin): @@ -19,13 +19,14 @@ class Process(Plugin, IndependentPlugin): profiles = ('system',) option_list = [ - ("lsof", "gathers information on all open files", "slow", True), - ("lsof-threads", "gathers threads' open file info if supported", - "slow", False), - ("smaps", "gathers all /proc/*/smaps files", "", False), - ("samples", "specify the number of samples that iotop will capture, " - "with an interval of 0.5 seconds between samples", "", "20"), - ("numprocs", "number of processes to collect /proc data of", '', 2048) + PluginOpt('lsof', default=True, desc='collect info on all open files'), + PluginOpt('lsof-threads', default=False, + desc='collect threads\' open file info if supported'), + PluginOpt('smaps', default=False, desc='collect /proc/*/smaps files'), + PluginOpt('samples', default=20, val_type=int, + desc='number of iotop samples to collect'), + PluginOpt('numprocs', default=2048, val_type=int, + desc='number of process to collect /proc data of') ] def setup(self): diff --git a/sos/report/plugins/psacct.py b/sos/report/plugins/psacct.py index efb0d88a..6c89c75a 100644 --- a/sos/report/plugins/psacct.py +++ b/sos/report/plugins/psacct.py @@ -6,7 +6,8 @@ # # 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, RedHatPlugin, DebianPlugin, + UbuntuPlugin, PluginOpt) class Psacct(Plugin): @@ -15,8 +16,9 @@ class Psacct(Plugin): plugin_name = "psacct" profiles = ('system',) - option_list = [("all", "collect all process accounting files", - "slow", False)] + option_list = [ + PluginOpt('all', default=False, desc='collect all accounting files') + ] packages = ("psacct", ) diff --git a/sos/report/plugins/pulp.py b/sos/report/plugins/pulp.py index 5a620751..aa2a1642 100644 --- a/sos/report/plugins/pulp.py +++ b/sos/report/plugins/pulp.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt from pipes import quote from re import match @@ -21,7 +21,8 @@ class Pulp(Plugin, RedHatPlugin): packages = ("pulp-server", "pulp-katello", "python3-pulpcore") files = ("/etc/pulp/settings.py",) option_list = [ - ('tasks', 'number of tasks to collect from DB queries', 'fast', 200) + PluginOpt('tasks', default=200, + desc='number of tasks to collect from DB queries') ] def setup(self): diff --git a/sos/report/plugins/pulpcore.py b/sos/report/plugins/pulpcore.py index be526035..7a5d461c 100644 --- a/sos/report/plugins/pulpcore.py +++ b/sos/report/plugins/pulpcore.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt from pipes import quote from re import match @@ -21,7 +21,7 @@ class PulpCore(Plugin, IndependentPlugin): commands = ("pulpcore-manager",) files = ("/etc/pulp/settings.py",) option_list = [ - ('task-days', 'days of tasks history', 'fast', 7) + PluginOpt('task-days', default=7, desc='days of task history') ] def parse_settings_config(self): diff --git a/sos/report/plugins/pxe.py b/sos/report/plugins/pxe.py index 48fcff46..cd6ef366 100644 --- a/sos/report/plugins/pxe.py +++ b/sos/report/plugins/pxe.py @@ -6,7 +6,8 @@ # # 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, RedHatPlugin, DebianPlugin, + UbuntuPlugin, PluginOpt) class Pxe(Plugin): @@ -14,8 +15,10 @@ class Pxe(Plugin): short_desc = 'PXE service' plugin_name = "pxe" profiles = ('sysmgmt', 'network') - option_list = [("tftpboot", 'gathers content from the tftpboot path', - 'slow', False)] + option_list = [ + PluginOpt('tftpboot', default=False, + desc='collect content from tftpboot path') + ] class RedHatPxe(Pxe, RedHatPlugin): diff --git a/sos/report/plugins/python.py b/sos/report/plugins/python.py index 95dbabdb..d5416f28 100644 --- a/sos/report/plugins/python.py +++ b/sos/report/plugins/python.py @@ -8,7 +8,8 @@ # # 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, RedHatPlugin, DebianPlugin, + UbuntuPlugin, PluginOpt) from sos.policies.distros.redhat import RHELPolicy import os import json @@ -43,8 +44,9 @@ class RedHatPython(Python, RedHatPlugin): packages = ('python', 'python36', 'python2', 'python3', 'platform-python') option_list = [ - ('hashes', "gather hashes for all python files", 'slow', - False)] + PluginOpt('hashes', default=False, + desc='collect hashes for all python files') + ] def setup(self): self.add_cmd_output(['python2 -V', 'python3 -V']) diff --git a/sos/report/plugins/qpid.py b/sos/report/plugins/qpid.py index 2cf42980..2e65ea5b 100644 --- a/sos/report/plugins/qpid.py +++ b/sos/report/plugins/qpid.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class Qpid(Plugin, RedHatPlugin): @@ -17,12 +17,15 @@ class Qpid(Plugin, RedHatPlugin): profiles = ('services',) packages = ('qpidd', 'qpid-cpp-server', 'qpid-tools') - option_list = [("port", "listening port to connect to", '', ""), - ("ssl-certificate", - "Path to file containing client SSL certificate", '', ""), - ("ssl-key", - "Path to file containing client SSL private key", '', ""), - ("ssl", "enforce SSL / amqps connection", '', False)] + option_list = [ + PluginOpt('port', default='', val_type=int, + desc='listening port to connect to'), + PluginOpt('ssl-certificate', default='', val_type=str, + desc='Path to file containing client SSL certificate'), + PluginOpt('ssl-key', default='', val_type=str, + desc='Path to file containing client SSL private key'), + PluginOpt('ssl', default=False, desc='enforce SSL amqps connection') + ] def setup(self): """ performs data collection for qpid broker """ diff --git a/sos/report/plugins/qpid_dispatch.py b/sos/report/plugins/qpid_dispatch.py index 78ac5019..12f25988 100644 --- a/sos/report/plugins/qpid_dispatch.py +++ b/sos/report/plugins/qpid_dispatch.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt from socket import gethostname @@ -20,12 +20,16 @@ class QpidDispatch(Plugin, RedHatPlugin): profiles = ('services',) packages = ('qdrouterd', 'qpid-dispatch-tools', 'qpid-dispatch-router') - option_list = [("port", "listening port to connect to", '', ""), - ("ssl-certificate", - "Path to file containing client SSL certificate", '', ""), - ("ssl-key", - "Path to file containing client SSL private key", '', ""), - ("ssl-trustfile", "trusted CA database file", '', "")] + option_list = [ + PluginOpt('port', default='', val_type=int, + desc='listening port to connect to'), + PluginOpt('ssl-certificate', default='', val_type=str, + desc='Path to file containing client SSL certificate'), + PluginOpt('ssl-key', default='', val_type=str, + desc='Path to file containing client SSL private key'), + PluginOpt('ssl-trustfile', default='', val_type=str, + desc='trusted CA database file') + ] def setup(self): """ performs data collection for qpid dispatch router """ diff --git a/sos/report/plugins/rpm.py b/sos/report/plugins/rpm.py index 88dede8b..54bc9789 100644 --- a/sos/report/plugins/rpm.py +++ b/sos/report/plugins/rpm.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class Rpm(Plugin, RedHatPlugin): @@ -16,10 +16,12 @@ class Rpm(Plugin, RedHatPlugin): plugin_name = 'rpm' profiles = ('system', 'packagemanager') - option_list = [("rpmq", "queries for package information via rpm -q", - "fast", True), - ("rpmva", "runs a verify on all packages", "slow", False), - ("rpmdb", "collect /var/lib/rpm", "slow", False)] + option_list = [ + PluginOpt('rpmq', default=True, + desc='query package information with rpm -q'), + PluginOpt('rpmva', default=False, desc='verify all packages'), + PluginOpt('rpmdb', default=False, desc='collect /var/lib/rpm') + ] verify_packages = ('rpm',) diff --git a/sos/report/plugins/sar.py b/sos/report/plugins/sar.py index b11ea29d..669f5d7b 100644 --- a/sos/report/plugins/sar.py +++ b/sos/report/plugins/sar.py @@ -6,7 +6,8 @@ # # 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, RedHatPlugin, DebianPlugin, + UbuntuPlugin, PluginOpt) import os import re @@ -20,8 +21,10 @@ class Sar(Plugin,): packages = ('sysstat',) sa_path = '/var/log/sa' - option_list = [("all_sar", "gather all system activity records", - "", False)] + option_list = [ + PluginOpt('all_sar', default=False, + desc="gather all system activity records") + ] def setup(self): self.add_copy_spec(os.path.join(self.sa_path, '*'), diff --git a/sos/report/plugins/selinux.py b/sos/report/plugins/selinux.py index 2f595bbb..e55a6cce 100644 --- a/sos/report/plugins/selinux.py +++ b/sos/report/plugins/selinux.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class SELinux(Plugin, RedHatPlugin): @@ -16,8 +16,10 @@ class SELinux(Plugin, RedHatPlugin): plugin_name = 'selinux' profiles = ('container', 'system', 'security', 'openshift') - option_list = [("fixfiles", 'Print incorrect file context labels', - 'slow', False)] + option_list = [ + PluginOpt('fixfiles', default=False, + desc='collect incorrect file context labels') + ] packages = ('libselinux',) def setup(self): diff --git a/sos/report/plugins/services.py b/sos/report/plugins/services.py index 4e3c2f4b..6c137b2f 100644 --- a/sos/report/plugins/services.py +++ b/sos/report/plugins/services.py @@ -6,7 +6,8 @@ # # 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, RedHatPlugin, DebianPlugin, + UbuntuPlugin, PluginOpt) class Services(Plugin): @@ -16,8 +17,10 @@ class Services(Plugin): plugin_name = "services" profiles = ('system', 'boot') - option_list = [("servicestatus", "get a status of all running services", - "slow", False)] + option_list = [ + PluginOpt('servicestatus', default=False, + desc='collect status of all running services') + ] def setup(self): self.add_copy_spec([ diff --git a/sos/report/plugins/skydive.py b/sos/report/plugins/skydive.py index 07041557..829602aa 100644 --- a/sos/report/plugins/skydive.py +++ b/sos/report/plugins/skydive.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt import os @@ -26,9 +26,12 @@ class Skydive(Plugin, RedHatPlugin): password_warn_text = " (password visible in process listings)" option_list = [ - ("username", "skydive user name", "", ""), - ("password", "skydive password" + password_warn_text, "", ""), - ("analyzer", "skydive analyzer address", "", "") + PluginOpt('username', default='', val_type=str, + desc='skydive username'), + PluginOpt('password', default='', val_type=str, + desc='skydive password' + password_warn_text), + PluginOpt('analyzer', default='', val_type=str, + desc='skydive analyzer address') ] def setup(self): diff --git a/sos/report/plugins/smclient.py b/sos/report/plugins/smclient.py index e9f1e0f5..88a6cfef 100644 --- a/sos/report/plugins/smclient.py +++ b/sos/report/plugins/smclient.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt class SMcli(Plugin, IndependentPlugin): @@ -19,7 +19,7 @@ class SMcli(Plugin, IndependentPlugin): packages = ('SMclient',) option_list = [ - ("debug", "capture support debug data", "slow", False), + PluginOpt('debug', default=False, desc='capture support debug data') ] def setup(self): diff --git a/sos/report/plugins/storcli.py b/sos/report/plugins/storcli.py index 720c407d..5dbc2b32 100644 --- a/sos/report/plugins/storcli.py +++ b/sos/report/plugins/storcli.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt class StorCLI(Plugin, IndependentPlugin): @@ -18,7 +18,7 @@ class StorCLI(Plugin, IndependentPlugin): packages = ('storcli',) option_list = [ - ("json", "collect data in JSON format", "fast", False) + PluginOpt('json', default=False, desc='collect data in JSON format') ] def setup(self): diff --git a/sos/report/plugins/veritas.py b/sos/report/plugins/veritas.py index b8bc5aa7..c3e38bda 100644 --- a/sos/report/plugins/veritas.py +++ b/sos/report/plugins/veritas.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt class Veritas(Plugin, RedHatPlugin): @@ -18,8 +18,10 @@ class Veritas(Plugin, RedHatPlugin): # Information about VRTSexplorer obtained from # http://seer.entsupport.symantec.com/docs/243150.htm - option_list = [("script", "Define VRTSexplorer script path", "", - "/opt/VRTSspt/VRTSexplorer")] + option_list = [ + PluginOpt('script', default='/opt/VRTSspt/VRTSexplorer', + desc='Path to VRTSexploer script') + ] def check_enabled(self): return self.path_isfile(self.get_option("script")) diff --git a/sos/report/plugins/watchdog.py b/sos/report/plugins/watchdog.py index 7fcbd409..1bf3f4cb 100644 --- a/sos/report/plugins/watchdog.py +++ b/sos/report/plugins/watchdog.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt from glob import glob import os @@ -22,7 +22,8 @@ class Watchdog(Plugin, RedHatPlugin): packages = ('watchdog',) option_list = [ - ('conf_file', 'watchdog config file', 'fast', '/etc/watchdog.conf'), + PluginOpt('conf_file', default='/etc/watchdog.conf', + desc='watchdog config file') ] def get_log_dir(self, conf_file): diff --git a/sos/report/plugins/yum.py b/sos/report/plugins/yum.py index 00ea5aa7..d551573e 100644 --- a/sos/report/plugins/yum.py +++ b/sos/report/plugins/yum.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin +from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt import os YUM_PLUGIN_PATH = "/usr/lib/yum-plugins/" @@ -24,9 +24,10 @@ class Yum(Plugin, RedHatPlugin): verify_packages = ('yum',) option_list = [ - ("yumlist", "list repositories and packages", "slow", False), - ("yumdebug", "gather yum debugging data", "slow", False), - ("yum-history-info", "gather yum history info", "slow", False), + PluginOpt('yumlist', default=False, desc='list repos and packages'), + PluginOpt('yumdebug', default=False, desc='collect yum debug data'), + PluginOpt('yum-history-info', default=False, + desc='collect yum history info for all transactions') ] def setup(self): -- cgit