Blame SOURCES/sos-bz1923938-sos-log-effective-options.patch

bf10fb
From 00d12ad3cf24dcc6c73e9bcf63db1d3f17e58bb1 Mon Sep 17 00:00:00 2001
bf10fb
From: Jake Hunsaker <jhunsake@redhat.com>
bf10fb
Date: Thu, 1 Jul 2021 10:50:54 -0400
bf10fb
Subject: [PATCH] [sosnode] Properly format skip-commands and skip-files on
bf10fb
 nodes
bf10fb
bf10fb
Fixes an issue where options provided for `skip-commands` and
bf10fb
`skip-files` were not properly formatted, thus causing an exception
bf10fb
during the finalization of the node's sos command.
bf10fb
bf10fb
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
bf10fb
---
bf10fb
 sos/collector/sosnode.py | 5 +++--
bf10fb
 1 file changed, 3 insertions(+), 2 deletions(-)
bf10fb
bf10fb
diff --git a/sos/collector/sosnode.py b/sos/collector/sosnode.py
bf10fb
index 6597d236..426edcba 100644
bf10fb
--- a/sos/collector/sosnode.py
bf10fb
+++ b/sos/collector/sosnode.py
bf10fb
@@ -734,11 +734,12 @@ class SosNode():
bf10fb
         if self.check_sos_version('4.1'):
bf10fb
             if self.opts.skip_commands:
bf10fb
                 sos_opts.append(
bf10fb
-                    '--skip-commands=%s' % (quote(self.opts.skip_commands))
bf10fb
+                    '--skip-commands=%s' % (
bf10fb
+                        quote(','.join(self.opts.skip_commands)))
bf10fb
                 )
bf10fb
             if self.opts.skip_files:
bf10fb
                 sos_opts.append(
bf10fb
-                    '--skip-files=%s' % (quote(self.opts.skip_files))
bf10fb
+                    '--skip-files=%s' % (quote(','.join(self.opts.skip_files)))
bf10fb
                 )
bf10fb
 
bf10fb
         if self.check_sos_version('4.2'):
bf10fb
-- 
bf10fb
2.31.1
bf10fb
bf10fb
From de7edce3f92ed50abcb28dd0dbcbeb104dc7c679 Mon Sep 17 00:00:00 2001
bf10fb
From: Pavel Moravec <pmoravec@redhat.com>
bf10fb
Date: Fri, 2 Jul 2021 09:52:11 +0200
bf10fb
Subject: [PATCH] [collector] fix a typo in --plugin-option
bf10fb
bf10fb
Sos report uses --plugin-option or --plugopts.
bf10fb
bf10fb
Relevant: #2606
bf10fb
bf10fb
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
bf10fb
---
bf10fb
 sos/collector/__init__.py | 2 +-
bf10fb
 1 file changed, 1 insertion(+), 1 deletion(-)
bf10fb
bf10fb
diff --git a/sos/collector/__init__.py b/sos/collector/__init__.py
bf10fb
index 6d96d692..f072287e 100644
bf10fb
--- a/sos/collector/__init__.py
bf10fb
+++ b/sos/collector/__init__.py
bf10fb
@@ -272,7 +272,7 @@ class SoSCollector(SoSComponent):
bf10fb
                              help="chroot executed commands to SYSROOT")
bf10fb
         sos_grp.add_argument('-e', '--enable-plugins', action="extend",
bf10fb
                              help='Enable specific plugins for sosreport')
bf10fb
-        sos_grp.add_argument('-k', '--plugin-options', action="extend",
bf10fb
+        sos_grp.add_argument('-k', '--plugin-option', action="extend",
bf10fb
                              help='Plugin option as plugname.option=value')
bf10fb
         sos_grp.add_argument('--log-size', default=0, type=int,
bf10fb
                              help='Limit the size of individual logs (in MiB)')
bf10fb
-- 
bf10fb
2.31.1
bf10fb
bf10fb
From 24a79ae8df8f29276f6139c68d4ba9b05114f951 Mon Sep 17 00:00:00 2001
bf10fb
From: Pavel Moravec <pmoravec@redhat.com>
bf10fb
Date: Fri, 2 Jul 2021 09:53:47 +0200
bf10fb
Subject: [PATCH] [options] allow variant option names in config file
bf10fb
bf10fb
While cmdline allows --plugin-option as well as --plugopts,
bf10fb
it stores the value under `plugopts` key. Therefore parsing
bf10fb
config file ignores --plugin-option.
bf10fb
bf10fb
Similarly for --name/--label and --profile/--profiles.
bf10fb
bf10fb
When processing config file, we must unify those potentially duplicit
bf10fb
keys.
bf10fb
bf10fb
Resolves: #2606
bf10fb
bf10fb
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
bf10fb
---
bf10fb
 sos/options.py | 9 +++++++++
bf10fb
 1 file changed, 9 insertions(+)
bf10fb
bf10fb
diff --git a/sos/options.py b/sos/options.py
bf10fb
index 1eda55d6..a014a022 100644
bf10fb
--- a/sos/options.py
bf10fb
+++ b/sos/options.py
bf10fb
@@ -186,9 +186,18 @@ class SoSOptions():
bf10fb
                 if 'verbose' in odict.keys():
bf10fb
                     odict['verbosity'] = int(odict.pop('verbose'))
bf10fb
                 # convert options names
bf10fb
+                # unify some of them if multiple variants of the
bf10fb
+                # cmdoption exist
bf10fb
+                rename_opts = {
bf10fb
+                    'name': 'label',
bf10fb
+                    'plugin_option': 'plugopts',
bf10fb
+                    'profile': 'profiles'
bf10fb
+                }
bf10fb
                 for key in list(odict):
bf10fb
                     if '-' in key:
bf10fb
                         odict[key.replace('-', '_')] = odict.pop(key)
bf10fb
+                    if key in rename_opts:
bf10fb
+                        odict[rename_opts[key]] = odict.pop(key)
bf10fb
                 # set the values according to the config file
bf10fb
                 for key, val in odict.items():
bf10fb
                     if isinstance(val, str):
bf10fb
-- 
bf10fb
2.31.1
bf10fb
89c8f0
From c7d3644c0c64e9e5439806250592a55c8e2de26f Mon Sep 17 00:00:00 2001
89c8f0
From: Pavel Moravec <pmoravec@redhat.com>
89c8f0
Date: Thu, 1 Jul 2021 08:11:15 +0200
89c8f0
Subject: [PATCH] [report,collect] unify --map-file arguments
89c8f0
89c8f0
Unify --map[-file] argument among report/collect/clean.
89c8f0
89c8f0
Resolves: #2602
89c8f0
89c8f0
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
89c8f0
---
89c8f0
 sos/cleaner/__init__.py   | 2 +-
89c8f0
 sos/collector/__init__.py | 2 +-
89c8f0
 sos/report/__init__.py    | 2 +-
89c8f0
 3 files changed, 3 insertions(+), 3 deletions(-)
89c8f0
89c8f0
diff --git a/sos/cleaner/__init__.py b/sos/cleaner/__init__.py
89c8f0
index 7414b55e0..4c9837826 100644
89c8f0
--- a/sos/cleaner/__init__.py
89c8f0
+++ b/sos/cleaner/__init__.py
89c8f0
@@ -192,7 +192,7 @@ def add_parser_options(cls, parser):
89c8f0
                                      'file for obfuscation'))
89c8f0
         clean_grp.add_argument('--no-update', dest='no_update', default=False,
89c8f0
                                action='store_true',
89c8f0
-                               help='Do not update the --map file with new '
89c8f0
+                               help='Do not update the --map-file with new '
89c8f0
                                     'mappings from this run')
89c8f0
         clean_grp.add_argument('--keep-binary-files', default=False,
89c8f0
                                action='store_true',
89c8f0
diff --git a/sos/collector/__init__.py b/sos/collector/__init__.py
89c8f0
index 7b8cfcf72..6d96d6923 100644
89c8f0
--- a/sos/collector/__init__.py
89c8f0
+++ b/sos/collector/__init__.py
89c8f0
@@ -427,7 +427,7 @@ def add_parser_options(cls, parser):
89c8f0
         cleaner_grp.add_argument('--no-update', action='store_true',
89c8f0
                                  default=False, dest='no_update',
89c8f0
                                  help='Do not update the default cleaner map')
89c8f0
-        cleaner_grp.add_argument('--map', dest='map_file',
89c8f0
+        cleaner_grp.add_argument('--map-file', dest='map_file',
89c8f0
                                  default='/etc/sos/cleaner/default_mapping',
89c8f0
                                  help=('Provide a previously generated mapping'
89c8f0
                                        ' file for obfuscation'))
89c8f0
diff --git a/sos/report/__init__.py b/sos/report/__init__.py
89c8f0
index 7ad2d24a4..411c4eb03 100644
89c8f0
--- a/sos/report/__init__.py
89c8f0
+++ b/sos/report/__init__.py
89c8f0
@@ -341,7 +341,7 @@ def add_parser_options(cls, parser):
89c8f0
         cleaner_grp.add_argument('--no-update', action='store_true',
89c8f0
                                  default=False, dest='no_update',
89c8f0
                                  help='Do not update the default cleaner map')
89c8f0
-        cleaner_grp.add_argument('--map', dest='map_file',
89c8f0
+        cleaner_grp.add_argument('--map-file', dest='map_file',
89c8f0
                                  default='/etc/sos/cleaner/default_mapping',
89c8f0
                                  help=('Provide a previously generated mapping'
89c8f0
                                        ' file for obfuscation'))
89c8f0
From fd75745e7a5a6c5def8e6d23190227872b9912c3 Mon Sep 17 00:00:00 2001
89c8f0
From: Jake Hunsaker <jhunsake@redhat.com>
89c8f0
Date: Wed, 11 Aug 2021 10:48:41 -0400
89c8f0
Subject: [PATCH] [sosnode] Fix passing of plugin options when using
89c8f0
 `--only-plugins`
89c8f0
89c8f0
Fixes the handling of plugin options passed by `sos collect` to each
89c8f0
node by first aligning the SoSOption name to those of `report`
89c8f0
(`plugopts`), and second re-arranges the handling of plugin options and
89c8f0
preset options passed by the user when also using `--only-plugins` so
89c8f0
that the former are preserved and passed only with the `--only-plugins`
89c8f0
option value.
89c8f0
89c8f0
Resolves: #2641
89c8f0
89c8f0
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
89c8f0
---
89c8f0
 sos/collector/__init__.py |  5 +++--
89c8f0
 sos/collector/sosnode.py  | 34 +++++++++++++++++-----------------
89c8f0
 2 files changed, 20 insertions(+), 19 deletions(-)
89c8f0
89c8f0
diff --git a/sos/collector/__init__.py b/sos/collector/__init__.py
89c8f0
index 57ef074e..70b7a69e 100644
89c8f0
--- a/sos/collector/__init__.py
89c8f0
+++ b/sos/collector/__init__.py
89c8f0
@@ -84,7 +84,7 @@ class SoSCollector(SoSComponent):
89c8f0
         'only_plugins': [],
89c8f0
         'password': False,
89c8f0
         'password_per_node': False,
89c8f0
-        'plugin_options': [],
89c8f0
+        'plugopts': [],
89c8f0
         'plugin_timeout': None,
89c8f0
         'cmd_timeout': None,
89c8f0
         'preset': '',
89c8f0
@@ -273,7 +273,8 @@ class SoSCollector(SoSComponent):
89c8f0
                              help="chroot executed commands to SYSROOT")
89c8f0
         sos_grp.add_argument('-e', '--enable-plugins', action="extend",
89c8f0
                              help='Enable specific plugins for sosreport')
89c8f0
-        sos_grp.add_argument('-k', '--plugin-option', action="extend",
89c8f0
+        sos_grp.add_argument('-k', '--plugin-option', '--plugopts',
89c8f0
+                             action="extend", dest='plugopts',
89c8f0
                              help='Plugin option as plugname.option=value')
89c8f0
         sos_grp.add_argument('--log-size', default=0, type=int,
89c8f0
                              help='Limit the size of individual logs (in MiB)')
89c8f0
diff --git a/sos/collector/sosnode.py b/sos/collector/sosnode.py
89c8f0
index 426edcba..5d05c297 100644
89c8f0
--- a/sos/collector/sosnode.py
89c8f0
+++ b/sos/collector/sosnode.py
89c8f0
@@ -667,10 +667,10 @@ class SosNode():
89c8f0
 
89c8f0
         if self.cluster.sos_plugin_options:
89c8f0
             for opt in self.cluster.sos_plugin_options:
89c8f0
-                if not any(opt in o for o in self.plugin_options):
89c8f0
+                if not any(opt in o for o in self.plugopts):
89c8f0
                     option = '%s=%s' % (opt,
89c8f0
                                         self.cluster.sos_plugin_options[opt])
89c8f0
-                    self.plugin_options.append(option)
89c8f0
+                    self.plugopts.append(option)
89c8f0
 
89c8f0
         # set master-only options
89c8f0
         if self.cluster.check_node_is_master(self):
89c8f0
@@ -688,7 +688,7 @@ class SosNode():
89c8f0
         self.only_plugins = list(self.opts.only_plugins)
89c8f0
         self.skip_plugins = list(self.opts.skip_plugins)
89c8f0
         self.enable_plugins = list(self.opts.enable_plugins)
89c8f0
-        self.plugin_options = list(self.opts.plugin_options)
89c8f0
+        self.plugopts = list(self.opts.plugopts)
89c8f0
         self.preset = list(self.opts.preset)
89c8f0
 
89c8f0
     def finalize_sos_cmd(self):
89c8f0
@@ -754,6 +754,20 @@ class SosNode():
89c8f0
             os.path.join(self.host.sos_bin_path, self.sos_bin)
89c8f0
         )
89c8f0
 
89c8f0
+        if self.plugopts:
89c8f0
+            opts = [o for o in self.plugopts
89c8f0
+                    if self._plugin_exists(o.split('.')[0])
89c8f0
+                    and self._plugin_option_exists(o.split('=')[0])]
89c8f0
+            if opts:
89c8f0
+                sos_opts.append('-k %s' % quote(','.join(o for o in opts)))
89c8f0
+
89c8f0
+        if self.preset:
89c8f0
+            if self._preset_exists(self.preset):
89c8f0
+                sos_opts.append('--preset=%s' % quote(self.preset))
89c8f0
+            else:
89c8f0
+                self.log_debug('Requested to enable preset %s but preset does '
89c8f0
+                               'not exist on node' % self.preset)
89c8f0
+
89c8f0
         if self.only_plugins:
89c8f0
             plugs = [o for o in self.only_plugins if self._plugin_exists(o)]
89c8f0
             if len(plugs) != len(self.only_plugins):
89c8f0
@@ -792,20 +806,6 @@ class SosNode():
89c8f0
             if enable:
89c8f0
                 sos_opts.append('--enable-plugins=%s' % quote(enable))
89c8f0
 
89c8f0
-        if self.plugin_options:
89c8f0
-            opts = [o for o in self.plugin_options
89c8f0
-                    if self._plugin_exists(o.split('.')[0])
89c8f0
-                    and self._plugin_option_exists(o.split('=')[0])]
89c8f0
-            if opts:
89c8f0
-                sos_opts.append('-k %s' % quote(','.join(o for o in opts)))
89c8f0
-
89c8f0
-        if self.preset:
89c8f0
-            if self._preset_exists(self.preset):
89c8f0
-                sos_opts.append('--preset=%s' % quote(self.preset))
89c8f0
-            else:
89c8f0
-                self.log_debug('Requested to enable preset %s but preset does '
89c8f0
-                               'not exist on node' % self.preset)
89c8f0
-
89c8f0
         self.sos_cmd = "%s %s" % (sos_cmd, ' '.join(sos_opts))
89c8f0
         self.log_info('Final sos command set to %s' % self.sos_cmd)
89c8f0
         self.manifest.add_field('final_sos_command', self.sos_cmd)
89c8f0
-- 
89c8f0
2.31.1
89c8f0