diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2019-10-23 17:17:40 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-10-23 17:22:48 +0100 |
commit | 4413c11e9031a4b2c790d87ca96fb0095e1fbdeb (patch) | |
tree | 06df8e101cfa75303d6cd97b66f47b5c3fce2ecf | |
parent | 9c750ad0eb63ff93a27bc212140d9eb40a7c12d7 (diff) | |
download | sos-4413c11e9031a4b2c790d87ca96fb0095e1fbdeb.tar.gz |
[Plugin] fix plugin option regression (c4d06c5)
Commit c4d06c5 fixes an LGTM warning about the placement of the
else clause in the for loop of Plugin.set_option() but introduces
a regression setting valid plugin options:
# sosreport -vv --batch --debug --build -k rpm.rpmva=on
sosreport (version 3.8)
set sysroot to '/' (default)
[plugin:ovn_central] could not run 'podman ps': command not found
[plugin:ovn_central] could not run 'docker ps': command not found
no such option "rpmva" for plugin (rpm)
no such option "rpmva" for plugin (rpm)
The 'else' here is invalid: rather than applying to the existing
if statement inside the loop body the 'return False' should happen
unconditionally if the loop exits without finding any match.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/__init__.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index 0cff7f2b..ed55ea38 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -818,8 +818,7 @@ class Plugin(object): value = (defaulttype)(value) parms['enabled'] = value return True - else: - return False + return False def get_option(self, optionname, default=0): """Returns the first value that matches 'optionname' in parameters |