diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2020-12-09 10:21:32 -0500 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2020-12-10 16:13:17 -0500 |
commit | c2ddb50fbbb045daffa6fe5cf489fe47aeef4590 (patch) | |
tree | aaf241307f8ed36cb3308e3e7d927b8ce5905d24 | |
parent | 0d1775b5ffe76b4d8909122080c10092d73e7758 (diff) | |
download | sos-c2ddb50fbbb045daffa6fe5cf489fe47aeef4590.tar.gz |
[options] Fix --log-size=0 being ignored and unreported otherwise
The `--log-size` option was being silently ignored, due to a too-loose
conditional in `Component.apply_options_from_cmdline()` which was
inadvertently filtering out the option when a user set it to 0. Note
that this did not affect `sos.conf` settings for this same value.
Similarly, reporting the effective options after preset and cmdline
merging was skipping log-size when it was set to 0, since we normally
want to filter out null-value options (which imply they were not
invoked). Adding an explicit check for `log-size` here is the easiest
route forward to allow the reporting we expect.
Closes: #2334
Resolves: #2335
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/component.py | 2 | ||||
-rw-r--r-- | sos/options.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/sos/component.py b/sos/component.py index 00f27f5e..69d3b755 100644 --- a/sos/component.py +++ b/sos/component.py @@ -192,7 +192,7 @@ class SoSComponent(): for opt, val in codict.items(): if opt not in cmdopts.arg_defaults.keys(): continue - if val and val != opts.arg_defaults[opt]: + if val is not None and val != opts.arg_defaults[opt]: setattr(opts, opt, val) return opts diff --git a/sos/options.py b/sos/options.py index ba3db130..b82a7d36 100644 --- a/sos/options.py +++ b/sos/options.py @@ -282,6 +282,9 @@ class SoSOptions(): """ if name in ("add_preset", "del_preset", "desc", "note"): return False + # Exception list for options that still need to be reported when 0 + if name in ['log_size', 'plugin_timeout'] and value == 0: + return True return has_value(name, value) def argify(name, value): |