From 78851871666675f226e8b8886246107df343ab15 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Thu, 26 Apr 2018 12:42:00 +0100 Subject: [yum] fix yum plugin data collection Don't attempt to add a null string if there are no plugins to report on, and improve the formatting of the plugin-names and plugin-packages files. Signed-off-by: Bryn M. Reeves --- sos/plugins/yum.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sos/plugins/yum.py b/sos/plugins/yum.py index 1db5189a..1746389c 100644 --- a/sos/plugins/yum.py +++ b/sos/plugins/yum.py @@ -50,15 +50,17 @@ class Yum(Plugin, RedHatPlugin): # Get list of available plugins and their configuration files. if os.path.exists(YUM_PLUGIN_PATH) and os.path.isdir(YUM_PLUGIN_PATH): plugins = "" - names = "" for p in os.listdir(YUM_PLUGIN_PATH): if not p.endswith(".py"): continue plugins = plugins + " " if len(plugins) else "" plugins = plugins + os.path.join(YUM_PLUGIN_PATH, p) - names += "%s\n" % p[:-3] - self.add_cmd_output("rpm -qf %s" % plugins) - self.add_string_as_file(names, "plugin-names") + if len(plugins): + self.add_cmd_output("rpm -qf %s" % plugins, + suggest_filename="plugin-packages") + plugnames = [os.path.basename(p)[:-3] for p in plugins.split()] + plugnames = "%s\n" % "\n".join(plugnames) + self.add_string_as_file(plugnames, "plugin-names") self.add_copy_spec("/etc/yum/pluginconf.d") -- cgit