From 00d12ad3cf24dcc6c73e9bcf63db1d3f17e58bb1 Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Thu, 1 Jul 2021 10:50:54 -0400 Subject: [PATCH] [sosnode] Properly format skip-commands and skip-files on nodes Fixes an issue where options provided for `skip-commands` and `skip-files` were not properly formatted, thus causing an exception during the finalization of the node's sos command. Signed-off-by: Jake Hunsaker --- sos/collector/sosnode.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sos/collector/sosnode.py b/sos/collector/sosnode.py index 6597d236..426edcba 100644 --- a/sos/collector/sosnode.py +++ b/sos/collector/sosnode.py @@ -734,11 +734,12 @@ class SosNode(): if self.check_sos_version('4.1'): if self.opts.skip_commands: sos_opts.append( - '--skip-commands=%s' % (quote(self.opts.skip_commands)) + '--skip-commands=%s' % ( + quote(','.join(self.opts.skip_commands))) ) if self.opts.skip_files: sos_opts.append( - '--skip-files=%s' % (quote(self.opts.skip_files)) + '--skip-files=%s' % (quote(','.join(self.opts.skip_files))) ) if self.check_sos_version('4.2'): -- 2.31.1 From de7edce3f92ed50abcb28dd0dbcbeb104dc7c679 Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Fri, 2 Jul 2021 09:52:11 +0200 Subject: [PATCH] [collector] fix a typo in --plugin-option Sos report uses --plugin-option or --plugopts. Relevant: #2606 Signed-off-by: Pavel Moravec --- sos/collector/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sos/collector/__init__.py b/sos/collector/__init__.py index 6d96d692..f072287e 100644 --- a/sos/collector/__init__.py +++ b/sos/collector/__init__.py @@ -272,7 +272,7 @@ class SoSCollector(SoSComponent): help="chroot executed commands to SYSROOT") sos_grp.add_argument('-e', '--enable-plugins', action="extend", help='Enable specific plugins for sosreport') - sos_grp.add_argument('-k', '--plugin-options', action="extend", + sos_grp.add_argument('-k', '--plugin-option', action="extend", help='Plugin option as plugname.option=value') sos_grp.add_argument('--log-size', default=0, type=int, help='Limit the size of individual logs (in MiB)') -- 2.31.1 From 24a79ae8df8f29276f6139c68d4ba9b05114f951 Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Fri, 2 Jul 2021 09:53:47 +0200 Subject: [PATCH] [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 --- sos/options.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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): -- 2.31.1