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