aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2020-12-02 14:39:30 -0500
committerJake Hunsaker <jhunsake@redhat.com>2020-12-11 11:09:06 -0500
commit0c627820bebd038979482792200141f3e94f189a (patch)
tree3fba8fc414e750107fe81aec98520023033692ad
parentbc237190e7a7ce4d47d6b1f4a75b2d96b34a19f8 (diff)
downloadsos-0c627820bebd038979482792200141f3e94f189a.tar.gz
[wireless] Update enablement triggers and add predicate for iw commands
First, update the enablement trigger to use the `commands` tuple to use a policy's defined PATH to search for the `iw` command, rather than splitting out subclasses based on the `files` tuple. Second, add a predicate that requires the `cfg80211` kmod to be loaded before running any `iw` commands, as this command will load the module if it is not already loaded. Related: #2326 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/report/plugins/wireless.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/sos/report/plugins/wireless.py b/sos/report/plugins/wireless.py
index 1f4853cc..21d75dbf 100644
--- a/sos/report/plugins/wireless.py
+++ b/sos/report/plugins/wireless.py
@@ -6,31 +6,24 @@
#
# 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, SoSPredicate
-class Wireless(Plugin, DebianPlugin, UbuntuPlugin):
+class Wireless(Plugin, IndependentPlugin):
- short_desc = 'Wireless'
+ short_desc = 'Wireless Device Information'
plugin_name = 'wireless'
profiles = ('hardware', 'desktop', 'network')
- files = ('/sbin/iw', '/usr/sbin/iw')
+ commands = ('iw', )
def setup(self):
+ wireless_pred = SoSPredicate(self, kmods=['cfg80211'])
self.add_cmd_output([
"iw list",
"iw dev",
"iwconfig",
"iwlist scanning"
- ])
-
-
-class RedHatWireless(Wireless, RedHatPlugin):
-
- short_desc = 'Wireless'
-
- files = ('/usr/sbin/iw', '/usr/sbin/iwlist')
- packages = ('iw', 'wireless-tools')
+ ], pred=wireless_pred)
# vim: set et ts=4 sw=4 :