sosreport/sosreport — Issue #24: Class dispatcher based on distro specific plugins
Author: battlemidget
Created: 2012-02-16 20:24:30+00:00
State: open

Hey there

I've got some work going on to have sosreport running on Ubuntu boxes. One problem I'm seeing is even though we have 'RedHatPlugin, IndenpendentPlugin' and for my uses 'UbuntuPlugin' there is still not a decent way of deciding which commands should or shouldnt be run depending on the distro.

My suggestion (and I am going to work on this) is to have some sort of class dispatcher for the plugins. For example, in the general plugin we could have:

class general(Plugin, IndependentPlugin):
def setup(self):
self.collectoutput("some non specific data")

class generalRHEL(Plugin, RedHatPlugin):
def setup(self):
self.collectoutput("some rhel specific like RHN")

class generalUbuntu(Plugin, UbuntuPlugin):
def setup(self):
self.collectoutput("some ubuntu/debian specifics")

In our plugin class dispatcher we would do some sort of mapping like:

{'IndependentPlugin' : '%s' % (plugname,),
'RedHatPlugin': '%s%s' % (plugname, DistroPluginSpecific)}

This way we aren't littering 1 class with data to collect that may not pertain to the underlying distro.

What do you guys think?

Thanks
Adam