diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2019-08-18 18:49:21 -0400 |
---|---|---|
committer | Pavel Moravec <pmoravec@redhat.com> | 2019-08-25 12:52:33 +0200 |
commit | 75b17a1711e9122f32d7fd543ee74566089aad93 (patch) | |
tree | 0c856882af56ce736945cefd726b84dbc9555ebc | |
parent | 51fbec1cc057908e549f4b83ba482959c09e08ab (diff) | |
download | sos-75b17a1711e9122f32d7fd543ee74566089aad93.tar.gz |
[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 <jhunsake@redhat.com>
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/plugins/networking.py | 18 |
1 files 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. |