New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SCLPlugin doesn't work on EL8 and makes plugins using it not auto-load #2407
Comments
|
I wonder if this is due to the fact that we have: class RedHatForeman(Foreman, SCLPlugin, RedHatPlugin):and class SCLPlugin(RedHatPlugin)This might be causing an MRO exception during instantiation. If you instead remove |
|
Nope, that's not it. The PostgreSQL plugin doesn't do this double-inheritance from Line 80 in 00a25de
FWIW, this is rather easily reproducible with a CentOS 8 container: % podman run -ti --rm centos:8 bash
# yum install -y sos postgresql
# sosreport --profile services --list-plugins | grep PostgreSQL
WARNING: unable to set option for disabled or non-existing plugin (boot)
postgresql inactive PostgreSQL RDBMS(the Making the plugin definition be class RedHatPostgreSQL(PostgreSQL, RedHatPlugin)makes it work (after importing |
|
Right, so here's the logic for enabling plugins based on if an SCL is present: 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):
type(self)._scls_matched.append(scl)
return len(type(self)._scls_matched) > 0
return self._check_plugin_triggers(self.files,
self.packages,
self.commands,
self.services)So we don't even attempt to do the plugin verification based on the normal triggers if a plugin subclasses So, we have two options I believe:
The problem with option 1 would be controlling the The problem with option 2 is we'd have to come up with a way to determine which class to run if both a |
|
A quick test for I believe this should solve the issue for Foreman-on-Centos for plugin enablement, but I don't have such a test system available to me to validate if we need any additional protections for the |
|
The patch fixes it for Foreman too, yeah. It does yield two warnings when executing the plugin: But that's not bad as such -- we just don't have an SCL on EL8 and use system-ruby. We could guard the tfm gem list command with a |
It was found that if a system has `scl` available to it, and has a non-scl package installed for a plugin that subclasses `SCLPlugin`, but the scl packages are not installed, then the plugin will not be enabled even for the non-scl collections. This was due to a too-restrictive check if the plugin subclasses `SCLPlugins` that prevented the normal plugin triggers from being checked. The future of Software Collections is uncertain to the sos project at this time, but our current use of it is only 3 plugins; foreman, postgresql, and redis. As such, rather than splitting out `SCLPlugin` further into a distinct separate subclass of a plugin and then having to deal with how to determine which plugin class should be instantiated if both the scl and non-scl plugin would otherwise be enabled, make the `SCLPlugin` enablement conditions not prevent normal plugin enablement, and add gates to the `_scl` methods provided by `SCLPlugin` to abort any collection attempt if the specified scl is not detected. If, at a later date, the project sees further (new) use of the `SCLPlugin` then we can/will review this approach at that time. Closes: sosreport#2407 Resolves: sosreport#2412 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Ohai,
we (@theforeman) recently noticed that the
foremanplugin is not automatically enabled on EL8 (CentOS8). A bit of digging revealed that this is due to the fact that the plugin does subclassSCLPluginsos/sos/plugins/foreman.py
Lines 309 to 316 in 00a25de
And that seems to confuse
soson EL8 as there are no SCL there.Dropping the
SCLPlugin(and theadd_cmd_output_sclcall) makessos(sos-3.9.1-6.el8.noarch) auto-enable the plugin as desired when one of the listedpackagesis installed.We see the same behavior with the
postgresqlplugin, which also usesSCLPlugin.What's the correct solution here? Fixing
SCLPluginnot to fail on EL8? Making twoforemanplugins (well, three, we already haveRedHatForemanandDebianForeman)?The text was updated successfully, but these errors were encountered: