diff options
-rw-r--r-- | sos/plugins/dnf.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/sos/plugins/dnf.py b/sos/plugins/dnf.py index 8c878e1a..754ca26a 100644 --- a/sos/plugins/dnf.py +++ b/sos/plugins/dnf.py @@ -24,20 +24,16 @@ 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 IOError: - 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 get_modules_info(self, modules): + if not modules: + 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 modules.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/") @@ -74,7 +70,7 @@ class DNFPlugin(Plugin, RedHatPlugin): self.add_cmd_output("dnf history info %d" % tr_id) # Get list of dnf installed modules and their details. - module_file = self.collect_cmd_output("dnf module list --installed") - self.get_modules_info(module_file['filename']) + modules = self.collect_cmd_output("dnf module list --installed") + self.get_modules_info(modules['output']) # vim: set et ts=4 sw=4 : |