aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2018-05-14 14:07:25 +0200
committerBryn M. Reeves <bmr@redhat.com>2018-05-24 15:24:44 +0100
commitb9e4593699b8640fbb04875584867ab336937721 (patch)
tree493de1571af2c326d6180a246d153eb2dd79a899
parentadd8b12432fccdab0533caab8520730ce8c952a9 (diff)
downloadsos-b9e4593699b8640fbb04875584867ab336937721.tar.gz
[dnf] collect installed modules and info about them
collect "dnf module list --installed" and for each module, get info about it Resolves: #1292 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/dnf.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/sos/plugins/dnf.py b/sos/plugins/dnf.py
index dac2d38e..570bfb7d 100644
--- a/sos/plugins/dnf.py
+++ b/sos/plugins/dnf.py
@@ -24,6 +24,21 @@ class DNFPlugin(Plugin, RedHatPlugin):
("history-info", "detailed transaction history", "slow", False),
]
+ def get_modules_info(self, module_file):
+ if module_file:
+ try:
+ module_out = open(module_file).read()
+ except:
+ self._log_warn("could not read module list file")
+ return
+ # take just lines with the module names, i.e. containing "[i]" and
+ # not the "Hint: [d]efault, [e]nabled, [i]nstalled,.."
+ for line in module_out.splitlines():
+ if "[i]" in line:
+ module = line.split()[0]
+ if module != "Hint:":
+ self.add_cmd_output("dnf module info " + module)
+
def setup(self):
self.add_copy_spec([
"/etc/dnf/dnf.conf",
@@ -64,4 +79,8 @@ class DNFPlugin(Plugin, RedHatPlugin):
for tr_id in range(1, transactions+1):
self.add_cmd_output("dnf history info %d" % tr_id)
+ # Get list of dnf installed modules and their details.
+ module_file = self.get_cmd_output_now("dnf module list --installed")
+ self.get_modules_info(module_file)
+
# vim: set et ts=4 sw=4 :