57 lines
2.0 KiB
Diff
57 lines
2.0 KiB
Diff
From c2ddb50fbbb045daffa6fe5cf489fe47aeef4590 Mon Sep 17 00:00:00 2001
|
|
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
Date: Wed, 9 Dec 2020 10:21:32 -0500
|
|
Subject: [PATCH] [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>
|
|
---
|
|
sos/component.py | 2 +-
|
|
sos/options.py | 3 +++
|
|
2 files changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
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):
|
|
--
|
|
2.26.2
|
|
|