aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2016-02-12 16:33:55 +0000
committerBryn M. Reeves <bmr@redhat.com>2016-02-12 16:46:39 +0000
commitbb801ab4b8528d19f6b1f3a17f02a648dd26f531 (patch)
tree57cc06a38c092d197f829e293af5afe895596d0c
parent7ea7917781b402fab287722cd1c7cd97ea39118c (diff)
downloadsos-bb801ab4b8528d19f6b1f3a17f02a648dd26f531.tar.gz
[sosreport] do not include empty profiles in --list-profiles
If a profile has no usable plugin do not add its profiles to the list of available profiles and do not include them in the output of --list-profiles or --list-plugins. Fixes: #764. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/sosreport.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py
index e192b938..8c759edf 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -978,8 +978,6 @@ class SoSReport(object):
# plug-in is valid, let's decide whether run it or not
self.plugin_names.append(plugbase)
- if hasattr(plugin_class, "profiles"):
- self.profiles.update(plugin_class.profiles)
in_profile = self._is_in_profile(plugin_class)
if not in_profile:
@@ -998,6 +996,10 @@ class SoSReport(object):
self._skip(plugin_class, _("optional"))
continue
+ # only add the plugin's profiles once we know it is usable
+ if hasattr(plugin_class, "profiles"):
+ self.profiles.update(plugin_class.profiles)
+
# true when the null (empty) profile is active
default_profile = not using_profiles and in_profile
if self._is_not_specified(plugbase) and default_profile: