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