diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2021-07-02 09:53:47 +0200 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2021-07-12 10:56:46 -0400 |
commit | 24a79ae8df8f29276f6139c68d4ba9b05114f951 (patch) | |
tree | 7480128760d03f22fc80950601a618ce7c83f00f | |
parent | de7edce3f92ed50abcb28dd0dbcbeb104dc7c679 (diff) | |
download | sos-24a79ae8df8f29276f6139c68d4ba9b05114f951.tar.gz |
[options] allow variant option names in config file
While cmdline allows --plugin-option as well as --plugopts,
it stores the value under `plugopts` key. Therefore parsing
config file ignores --plugin-option.
Similarly for --name/--label and --profile/--profiles.
When processing config file, we must unify those potentially duplicit
keys.
Resolves: #2606
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/options.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sos/options.py b/sos/options.py index 1eda55d6..a014a022 100644 --- a/sos/options.py +++ b/sos/options.py @@ -186,9 +186,18 @@ class SoSOptions(): if 'verbose' in odict.keys(): odict['verbosity'] = int(odict.pop('verbose')) # convert options names + # unify some of them if multiple variants of the + # cmdoption exist + rename_opts = { + 'name': 'label', + 'plugin_option': 'plugopts', + 'profile': 'profiles' + } for key in list(odict): if '-' in key: odict[key.replace('-', '_')] = odict.pop(key) + if key in rename_opts: + odict[rename_opts[key]] = odict.pop(key) # set the values according to the config file for key, val in odict.items(): if isinstance(val, str): |