Skip to content

Commit

Permalink
[conntrack] collect conntrack commands only when kmods are loaded
Browse files Browse the repository at this point in the history
Two conntrack commands require several kmods - guard collection of the
commands by relevant SoSPredicate.

Resolves: #3279

Signed-off-by: Pavel Moravec <[email protected]>
  • Loading branch information
pmoravec authored and TurboTurtle committed Jun 22, 2023
1 parent ce5d4f5 commit dc75ed4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions sos/report/plugins/conntrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#
# See the LICENSE file in the source distribution for further information.

from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt
from sos.report.plugins import (Plugin, IndependentPlugin, SoSPredicate,
PluginOpt)


class Conntrack(Plugin, IndependentPlugin):
Expand Down Expand Up @@ -37,11 +38,18 @@ def setup(self):
"conntrackd -s expect",
])

# Collect info from conntrack
# Collect info from conntrack, only when all required kmods are loaded
ct_pred = SoSPredicate(self,
kmods=['nf_conntrack',
'nf_conntrack_netlink',
'nf_defrag_ipv4',
'nf_defrag_ipv6',
'nfnetlink'],
required={'kmods': 'all'})
self.add_cmd_output([
"conntrack -L -o extended",
"conntrack -S",
])
], pred=ct_pred)

# Capture additional data from namespaces; each command is run
# per-namespace
Expand Down

0 comments on commit dc75ed4

Please sign in to comment.