From 75b17a1711e9122f32d7fd543ee74566089aad93 Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Sun, 18 Aug 2019 18:49:21 -0400 Subject: [networking] Update predicate usage Updates predicate usage within the networking plugin to now require all kmods needed for 'ss' output to be present. Additionally, removes the extra check for --allow-system-changes since that is handled directly in predicate evaluation. Signed-off-by: Jake Hunsaker Signed-off-by: Pavel Moravec --- sos/plugins/networking.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py index f4de72bb..264c92df 100644 --- a/sos/plugins/networking.py +++ b/sos/plugins/networking.py @@ -157,7 +157,7 @@ class Networking(Plugin): ss_pred = SoSPredicate(self, kmods=[ 'tcp_diag', 'udp_diag', 'inet_diag', 'unix_diag', 'netlink_diag', 'af_packet_diag' - ]) + ], required={'kmods': 'all'}) self.add_cmd_output(ss_cmd, pred=ss_pred, changes=True) # When iptables is called it will load the modules @@ -222,18 +222,10 @@ class Networking(Plugin): ]) ss_cmd = ns_cmd_prefix + "ss -peaonmi" - ss_pred = SoSPredicate(self, kmods=['tcp_diag', 'udp_diag', - 'inet_diag', 'unix_diag', - 'netlink_diag', - 'af_packet_diag']) - if self.test_predicate(self, pred=ss_pred) or \ - self.get_option("allow_system_changes"): - self.add_cmd_output(ss_cmd) - else: - self._log_warn("skipped command '%s' as it requires some " - "*_diag kernel module that is unloaded; " - "use --allow-system-changes to collect it" - % ss_cmd) + # --allow-system-changes is handled directly in predicate + # evaluation, so plugin code does not need to separately + # check for it + self.add_cmd_output(ss_cmd, pred=ss_pred) # Devices that exist in a namespace use less ethtool # parameters. Run this per namespace. -- cgit