|
|
4b82b4 |
From f3dc8cd574614572d441f76c02453fd85d0c57e2 Mon Sep 17 00:00:00 2001
|
|
|
4b82b4 |
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
|
4b82b4 |
Date: Wed, 27 Apr 2022 10:40:55 -0400
|
|
|
4b82b4 |
Subject: [PATCH] [report] --list-plugins should report used, not default,
|
|
|
4b82b4 |
option values
|
|
|
4b82b4 |
|
|
|
4b82b4 |
When using `--list-plugins`, sos should report the values that will be
|
|
|
4b82b4 |
used in a given command, or with a given config file, not what the
|
|
|
4b82b4 |
default values are.
|
|
|
4b82b4 |
|
|
|
4b82b4 |
By reporting the set value, users can be sure their configuration or
|
|
|
4b82b4 |
commandline settings are being honored correctly before executing a
|
|
|
4b82b4 |
report collection.
|
|
|
4b82b4 |
|
|
|
4b82b4 |
Closes: #2921
|
|
|
4b82b4 |
|
|
|
4b82b4 |
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
|
4b82b4 |
---
|
|
|
4b82b4 |
sos/report/__init__.py | 22 +++++++++++++++-------
|
|
|
4b82b4 |
1 file changed, 15 insertions(+), 7 deletions(-)
|
|
|
4b82b4 |
|
|
|
4b82b4 |
diff --git a/sos/report/__init__.py b/sos/report/__init__.py
|
|
|
4b82b4 |
index 74c7973a..8735c903 100644
|
|
|
4b82b4 |
--- a/sos/report/__init__.py
|
|
|
4b82b4 |
+++ b/sos/report/__init__.py
|
|
|
4b82b4 |
@@ -868,24 +868,32 @@ class SoSReport(SoSComponent):
|
|
|
4b82b4 |
_defaults = self.loaded_plugins[0][1].get_default_plugin_opts()
|
|
|
4b82b4 |
for _opt in _defaults:
|
|
|
4b82b4 |
opt = _defaults[_opt]
|
|
|
4b82b4 |
- val = opt.default
|
|
|
4b82b4 |
- if opt.default == -1:
|
|
|
4b82b4 |
- val = TIMEOUT_DEFAULT
|
|
|
4b82b4 |
+ val = opt.value
|
|
|
4b82b4 |
+ if opt.value == -1:
|
|
|
4b82b4 |
+ if _opt == 'timeout':
|
|
|
4b82b4 |
+ val = self.opts.plugin_timeout or TIMEOUT_DEFAULT
|
|
|
4b82b4 |
+ elif _opt == 'cmd-timeout':
|
|
|
4b82b4 |
+ val = self.opts.cmd_timeout or TIMEOUT_DEFAULT
|
|
|
4b82b4 |
+ else:
|
|
|
4b82b4 |
+ val = TIMEOUT_DEFAULT
|
|
|
4b82b4 |
+ if opt.name == 'postproc':
|
|
|
4b82b4 |
+ val = not self.opts.no_postproc
|
|
|
4b82b4 |
self.ui_log.info(" %-25s %-15s %s" % (opt.name, val, opt.desc))
|
|
|
4b82b4 |
self.ui_log.info("")
|
|
|
4b82b4 |
|
|
|
4b82b4 |
self.ui_log.info(_("The following plugin options are available:"))
|
|
|
4b82b4 |
for opt in self.all_options:
|
|
|
4b82b4 |
if opt.name in ('timeout', 'postproc', 'cmd-timeout'):
|
|
|
4b82b4 |
- continue
|
|
|
4b82b4 |
+ if opt.value == opt.default:
|
|
|
4b82b4 |
+ continue
|
|
|
4b82b4 |
# format option value based on its type (int or bool)
|
|
|
4b82b4 |
- if isinstance(opt.default, bool):
|
|
|
4b82b4 |
- if opt.default is True:
|
|
|
4b82b4 |
+ if isinstance(opt.value, bool):
|
|
|
4b82b4 |
+ if opt.value is True:
|
|
|
4b82b4 |
tmpopt = "on"
|
|
|
4b82b4 |
else:
|
|
|
4b82b4 |
tmpopt = "off"
|
|
|
4b82b4 |
else:
|
|
|
4b82b4 |
- tmpopt = opt.default
|
|
|
4b82b4 |
+ tmpopt = opt.value
|
|
|
4b82b4 |
|
|
|
4b82b4 |
if tmpopt is None:
|
|
|
4b82b4 |
tmpopt = 0
|
|
|
4b82b4 |
--
|
|
|
4b82b4 |
2.34.3
|
|
|
4b82b4 |
|