diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2018-05-27 14:47:39 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-06-20 18:01:21 +0100 |
commit | ba667f3c322aef4b0e50e5248594baf0ac89b00b (patch) | |
tree | 6dc05f05cb9a95271ac9c674a7817c16bb1cf8a8 | |
parent | 55642c2144e1eb91e6d0ca282b734b387f2900a0 (diff) | |
download | sos-ba667f3c322aef4b0e50e5248594baf0ac89b00b.tar.gz |
[policies] return None in find_preset() if preset not found
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/policies/__init__.py | 3 | ||||
-rw-r--r-- | sos/sosreport.py | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index b8ed9d47..7b07d57c 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -571,8 +571,7 @@ No changes will be made to system configuration. if match == preset: return self.presets[match] - # Return default preset - return self.presets[""] + return None def probe_preset(self): """Return a ``PresetDefaults`` object matching the runing host. diff --git a/sos/sosreport.py b/sos/sosreport.py index e708961d..3d0ff49d 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -887,7 +887,7 @@ class SoSReport(object): :returns: True on success or False otherwise """ policy = self.policy - if policy.find_preset(name).name is not "": + if policy.find_preset(name): self.ui_log.error("A preset named '%s' already exists" % name) return False @@ -915,7 +915,7 @@ class SoSReport(object): :returns: True on success or False otherwise """ policy = self.policy - if policy.find_preset(name).name is "": + if not policy.find_preset(name): self.ui_log.error("Preset '%s' not found" % name) return False |