aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-03-09 11:19:14 -0500
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-03-17 12:41:07 -0400
commit78139a0ebf1ea211587c34111c0a1f0db5574f99 (patch)
tree4d16aa3f142e195ff5abd8f8bddc196641a42ffd
parent8d6db6da672be43cb70e186ef429ef684584ba17 (diff)
downloadsos-78139a0ebf1ea211587c34111c0a1f0db5574f99.tar.gz
[SCLPlugin] Drop SCLPlugin support
SCL is not used in RHEL past RHEL 7, and sos has not directly supported RHEL 7 for some years now due to the switch to python3 that came along with sos-4.0. Drop SCLPlugin, as it will never be used in modern sos. Cleanup any references to it in existing plugins as well. Resolves: #3559 Signed-off-by: Jake Hunsaker <jacob.r.hunsaker@gmail.com>
-rw-r--r--sos/policies/__init__.py4
-rw-r--r--sos/policies/distros/redhat.py1
-rw-r--r--sos/report/plugins/__init__.py79
-rw-r--r--sos/report/plugins/foreman.py11
-rw-r--r--sos/report/plugins/jars.py2
-rw-r--r--sos/report/plugins/postgresql.py30
-rw-r--r--sos/report/plugins/redis.py22
7 files changed, 12 insertions, 137 deletions
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index 0fa4de21..a13bf209 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -116,7 +116,6 @@ any third party.
vendor_urls = [('Example URL', "http://www.example.com/")]
vendor_text = ""
PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
- default_scl_prefix = ""
name_pattern = 'legacy'
presets = {"": PresetDefaults()}
presets_path = PRESETS_PATH
@@ -266,9 +265,6 @@ any third party.
return tempfile.gettempdir()
return opt_tmp_dir
- def get_default_scl_prefix(self):
- return self.default_scl_prefix
-
def match_plugin(self, plugin_classes):
"""Determine what subclass of a Plugin should be used based on the
tagging classes assigned to the Plugin
diff --git a/sos/policies/distros/redhat.py b/sos/policies/distros/redhat.py
index de04a577..fe74d0ee 100644
--- a/sos/policies/distros/redhat.py
+++ b/sos/policies/distros/redhat.py
@@ -43,7 +43,6 @@ class RedHatPolicy(LinuxPolicy):
]
_tmp_dir = "/var/tmp"
_in_container = False
- default_scl_prefix = '/opt/rh'
name_pattern = 'friendly'
upload_url = None
upload_user = None
diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py
index a370de86..94ee50d7 100644
--- a/sos/report/plugins/__init__.py
+++ b/sos/report/plugins/__init__.py
@@ -3213,10 +3213,6 @@ class Plugin():
corresponding paths, packages or commands and return True if any
are present.
- For SCLPlugin subclasses, it will check whether the plugin can be run
- for any of installed SCLs. If so, it will store names of these SCLs
- on the plugin class in addition to returning True.
-
For plugins with more complex enablement checks this method may be
overridden.
@@ -3242,34 +3238,12 @@ class Plugin():
if isinstance(self.services, str):
self.services = [self.services]
- if isinstance(self, SCLPlugin):
- # save SCLs that match files or packages
- type(self)._scls_matched = []
- for scl in self._get_scls():
- files = [f % {"scl_name": scl} for f in self.files]
- packages = [p % {"scl_name": scl} for p in self.packages]
- commands = [c % {"scl_name": scl} for c in self.commands]
- services = [s % {"scl_name": scl} for s in self.services]
- if self._check_plugin_triggers(files,
- packages,
- commands,
- services,
- # SCL containers don't exist
- ()):
- type(self)._scls_matched.append(scl)
- if type(self)._scls_matched:
- return True
-
return self._check_plugin_triggers(self.files,
self.packages,
self.commands,
self.services,
self.containers)
- if isinstance(self, SCLPlugin):
- # if files and packages weren't specified, we take all SCLs
- type(self)._scls_matched = self._get_scls()
-
return True
def _check_plugin_triggers(self, files, packages, commands, services,
@@ -3554,59 +3528,6 @@ class ExperimentalPlugin(PluginDistroTag):
pass
-class SCLPlugin(RedHatPlugin):
- """Superclass for plugins operating on Software Collections (SCLs).
-
- Subclasses of this plugin class can specify class.files and class.packages
- using "%(scl_name)s" interpolation. The plugin invoking mechanism will try
- to match these against all found SCLs on the system. SCLs that do match
- class.files or class.packages are then accessible via self.scls_matched
- when the plugin is invoked.
- """
-
- @property
- def scls_matched(self):
- if not hasattr(type(self), '_scls_matched'):
- type(self)._scls_matched = []
- return type(self)._scls_matched
-
- def _get_scls(self):
- output = sos_get_command_output("scl -l")["output"]
- return [scl.strip() for scl in output.splitlines()]
-
- def convert_cmd_scl(self, scl, cmd):
- """wrapping command in "scl enable" call
- """
- scl_cmd = "scl enable %s \"%s\"" % (scl, cmd)
- return scl_cmd
-
- # config files for Software Collections are under /etc/${prefix}/${scl} and
- # var files are under /var/${prefix}/${scl} where the ${prefix} is distro
- # specific path. So we need to insert the paths after the appropriate root
- # dir.
- def convert_copyspec_scl(self, scl, copyspec):
- scl_prefix = self.policy.get_default_scl_prefix()
- for rootdir in ['etc', 'var']:
- p = re.compile('^/%s/' % rootdir)
- copyspec = os.path.abspath(p.sub('/%s/%s/%s/' %
- (rootdir, scl_prefix, scl),
- copyspec))
- return copyspec
-
- def add_copy_spec_scl(self, scl, copyspecs):
- """Same as add_copy_spec, except that it prepends path to SCL root
- to "copyspecs".
- """
- if scl not in self.scls_matched:
- return
- if isinstance(copyspecs, str):
- copyspecs = [copyspecs]
- scl_copyspecs = []
- for copyspec in copyspecs:
- scl_copyspecs.append(self.convert_copyspec_scl(scl, copyspec))
- self.add_copy_spec(scl_copyspecs)
-
-
def import_plugin(name, superclasses=None):
"""Import name as a module and return a list of all classes defined in that
module. superclasses should be a tuple of valid superclasses to import,
diff --git a/sos/report/plugins/foreman.py b/sos/report/plugins/foreman.py
index c0394f58..8ca52741 100644
--- a/sos/report/plugins/foreman.py
+++ b/sos/report/plugins/foreman.py
@@ -11,9 +11,8 @@
from re import match
from shlex import quote
-from sos.report.plugins import (Plugin, RedHatPlugin, SCLPlugin,
- DebianPlugin, UbuntuPlugin, PluginOpt)
-from sos.utilities import is_executable
+from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin,
+ UbuntuPlugin, PluginOpt)
class Foreman(Plugin):
@@ -324,7 +323,7 @@ class Foreman(Plugin):
# attr so we can keep all log definitions centralized in the main class
-class RedHatForeman(Foreman, SCLPlugin, RedHatPlugin):
+class RedHatForeman(Foreman, RedHatPlugin):
apachepkg = 'httpd'
@@ -333,10 +332,6 @@ class RedHatForeman(Foreman, SCLPlugin, RedHatPlugin):
self.add_file_tags({
'/usr/share/foreman/.ssh/ssh_config': 'ssh_foreman_config',
})
- # if we are on RHEL7 with scl, wrap some Puma commands by
- # scl enable tfm 'command'
- if self.policy.dist_version() == 7 and is_executable('scl'):
- self.pumactl = "scl enable tfm '%s'" % self.pumactl
super().setup()
self.add_cmd_output('gem list')
diff --git a/sos/report/plugins/jars.py b/sos/report/plugins/jars.py
index 9c33c513..ef72f8d1 100644
--- a/sos/report/plugins/jars.py
+++ b/sos/report/plugins/jars.py
@@ -41,7 +41,7 @@ class Jars(Plugin, RedHatPlugin):
# Following paths can be optionally scanned as well. Note the scan can take
# *very* long time.
extra_jar_locations = (
- "/opt", # location for RHSCL and 3rd party software
+ "/opt", # location for 3rd party software
"/usr/local", # used by sysadmins when installing SW locally
"/var/lib" # Java services commonly explode WARs there
)
diff --git a/sos/report/plugins/postgresql.py b/sos/report/plugins/postgresql.py
index 4f73c3c8..22bde425 100644
--- a/sos/report/plugins/postgresql.py
+++ b/sos/report/plugins/postgresql.py
@@ -14,8 +14,8 @@
import os
-from sos.report.plugins import (Plugin, UbuntuPlugin, DebianPlugin, SCLPlugin,
- PluginOpt)
+from sos.report.plugins import (Plugin, UbuntuPlugin, DebianPlugin,
+ RedHatPlugin, PluginOpt)
from sos.utilities import find
@@ -45,7 +45,7 @@ class PostgreSQL(Plugin):
desc='database server listening port')
]
- def do_pg_dump(self, scl=None, filename="pgdump.tar"):
+ def do_pg_dump(self, filename="pgdump.tar"):
if self.get_option("dbname"):
if self.get_option("password") or "PGPASSWORD" in os.environ:
# We're only modifying this for ourself and our children so
@@ -67,8 +67,6 @@ class PostgreSQL(Plugin):
self.get_option("dbname")
)
- if scl is not None:
- cmd = self.convert_cmd_scl(scl, cmd)
self.add_cmd_output(cmd, suggest_filename=filename,
binary=True, sizelimit=0)
@@ -85,14 +83,7 @@ class PostgreSQL(Plugin):
self.add_cmd_output("du -sh %s" % self.get_option('pghome'))
-class RedHatPostgreSQL(PostgreSQL, SCLPlugin):
-
- packages = (
- 'postgresql',
- 'rh-postgresql95-postgresql-server',
- 'rh-postgresql10-postgresql-server',
- 'rh-postgresql12-postgresql-server',
- )
+class RedHatPostgreSQL(PostgreSQL, RedHatPlugin):
def setup(self):
super(RedHatPostgreSQL, self).setup()
@@ -100,19 +91,6 @@ class RedHatPostgreSQL(PostgreSQL, SCLPlugin):
pghome = self.get_option("pghome")
dirs = [pghome]
- for pkg in self.packages[1:]:
- # The scl name, package name, and service name all differ slightly
- # but is at least consistent in doing so across versions, so we
- # need to do some mangling here
- scl = pkg.split('-postgresql-')[0]
- _dir = self.convert_copyspec_scl(scl, pghome)
- dirs.append(_dir)
- if self.path_isdir(_dir):
- self.add_cmd_output("du -sh %s" % _dir)
- if (self.is_service_running(pkg.replace('-server', '')) and
- scl in self.scls_matched):
- self.do_pg_dump(scl=scl, filename="pgdump-scl-%s.tar" % scl)
-
for _dir in dirs:
# Copy PostgreSQL log files.
for filename in find("*.log", _dir):
diff --git a/sos/report/plugins/redis.py b/sos/report/plugins/redis.py
index 80b7190c..b560bdc4 100644
--- a/sos/report/plugins/redis.py
+++ b/sos/report/plugins/redis.py
@@ -9,17 +9,17 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.report.plugins import Plugin, SCLPlugin
+from sos.report.plugins import Plugin, IndependentPlugin
-class Redis(Plugin, SCLPlugin):
+class Redis(Plugin, IndependentPlugin):
short_desc = 'Redis, in-memory data structure store'
plugin_name = 'redis'
profiles = ('services',)
- packages = ('redis', 'rh-redis32', 'rh-redis5')
+ packages = ('redis',)
var_puppet_gen = "/var/lib/config-data/puppet-generated/redis"
@@ -31,17 +31,6 @@ class Redis(Plugin, SCLPlugin):
self.var_puppet_gen + "/etc/security/limits.d/"
])
- for pkg in self.packages[1:]:
- scl = pkg.split('rh-redis*-')[0]
- self.add_copy_spec_scl(scl, [
- '/etc/redis.conf',
- '/etc/redis.conf.puppet',
- '/etc/redis-sentinel.conf',
- '/etc/redis-sentinel.conf.puppet',
- '/var/log/redis/sentinel.log',
- '/var/log/redis/redis.log'
- ])
-
self.add_cmd_output("redis-cli info")
if self.get_option("all_logs"):
self.add_copy_spec([
@@ -53,10 +42,7 @@ class Redis(Plugin, SCLPlugin):
])
def postproc(self):
- for path in ["/etc/",
- self.var_puppet_gen + "/etc/",
- "/etc/opt/rh/rh-redis32/",
- "/etc/opt/rh/rh-redis5/"]:
+ for path in ["/etc/", self.var_puppet_gen + "/etc/"]:
self.do_file_sub(
path + "redis.conf",
r"(masterauth|requirepass)\s.*",