aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2019-08-16 13:15:32 +0100
committerBryn M. Reeves <bmr@redhat.com>2019-08-16 14:17:37 +0100
commitcda09a60bad174864104376453d23df34451a04e (patch)
tree6d4bd309711f1313b0a79e44be5a5bb7d10a8ff9
parentf84df0fe8311da4f478adf7b27a911fe3ed0535f (diff)
downloadsos-cda09a60bad174864104376453d23df34451a04e.tar.gz
[networking] use automatic pred warning for ss and macsec commands
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/networking.py24
1 files changed, 6 insertions, 18 deletions
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
index b698816a..f4de72bb 100644
--- a/sos/plugins/networking.py
+++ b/sos/plugins/networking.py
@@ -151,26 +151,14 @@ class Networking(Plugin):
# via --allow-system-changes option
ip_macsec_show_cmd = "ip -s macsec show"
macsec_pred = SoSPredicate(self, kmods=['macsec'])
- if self.test_predicate(self, pred=macsec_pred) or \
- self.get_option("allow_system_changes"):
- self.add_cmd_output(ip_macsec_show_cmd)
- else:
- self._log_warn("skipped command '%s' as it requires kernel module "
- "'macsecs' that is unloaded; use "
- "--allow-system-changes to collect it"
- % ip_macsec_show_cmd)
+ self.add_cmd_output(ip_macsec_show_cmd, pred=macsec_pred, changes=True)
ss_cmd = "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)
+ ss_pred = SoSPredicate(self, kmods=[
+ 'tcp_diag', 'udp_diag', 'inet_diag', 'unix_diag', 'netlink_diag',
+ 'af_packet_diag'
+ ])
+ self.add_cmd_output(ss_cmd, pred=ss_pred, changes=True)
# When iptables is called it will load the modules
# iptables and iptables_filter if they are not loaded.