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

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