Blame SOURCES/sos-bz1781148-foreman-psql-dynflow-explicit-cast.patch

a8a947
From 5fbbc63c5e41eab4fe34e3bb2c76abf26023bd55 Mon Sep 17 00:00:00 2001
a8a947
From: Pavel Moravec <pmoravec@redhat.com>
a8a947
Date: Mon, 9 Dec 2019 13:22:34 +0100
a8a947
Subject: [PATCH] [foreman] cast dynflow_execution_plans.uuid as varchar
a8a947
a8a947
Due to a change in foreman DB scheme, we must explicitly cast
a8a947
dynflow_execution_plans.uuid as a varchar since foreman-tasks
a8a947
0.15.5 .
a8a947
a8a947
The explicit casting works well on older versions as well.
a8a947
a8a947
Resolves: #1882
a8a947
a8a947
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
a8a947
---
a8a947
 sos/plugins/foreman.py | 12 +++++++-----
a8a947
 1 file changed, 7 insertions(+), 5 deletions(-)
a8a947
a8a947
diff --git a/sos/plugins/foreman.py b/sos/plugins/foreman.py
a8a947
index c8ed2850..c1546eae 100644
a8a947
--- a/sos/plugins/foreman.py
a8a947
+++ b/sos/plugins/foreman.py
a8a947
@@ -176,22 +176,24 @@ class Foreman(Plugin):
a8a947
         dyncmd = (
a8a947
             'select dynflow_execution_plans.* from foreman_tasks_tasks join '
a8a947
             'dynflow_execution_plans on (foreman_tasks_tasks.external_id = '
a8a947
-            'dynflow_execution_plans.uuid) where foreman_tasks_tasks.'
a8a947
+            'dynflow_execution_plans.uuid::varchar) where foreman_tasks_tasks.'
a8a947
             'started_at > NOW() - interval %s' % quote(months)
a8a947
         )
a8a947
 
a8a947
         dactioncmd = (
a8a947
              'select dynflow_actions.* from foreman_tasks_tasks join '
a8a947
              'dynflow_actions on (foreman_tasks_tasks.external_id = '
a8a947
-             'dynflow_actions.execution_plan_uuid) where foreman_tasks_tasks.'
a8a947
-             'started_at > NOW() - interval %s' % quote(months)
a8a947
+             'dynflow_actions.execution_plan_uuid::varchar) where '
a8a947
+             'foreman_tasks_tasks.started_at > NOW() - interval %s'
a8a947
+             % quote(months)
a8a947
         )
a8a947
 
a8a947
         dstepscmd = (
a8a947
             'select dynflow_steps.* from foreman_tasks_tasks join '
a8a947
             'dynflow_steps on (foreman_tasks_tasks.external_id = '
a8a947
-            'dynflow_steps.execution_plan_uuid) where foreman_tasks_tasks.'
a8a947
-            'started_at > NOW() - interval %s' % quote(months)
a8a947
+            'dynflow_steps.execution_plan_uuid::varchar) where '
a8a947
+            'foreman_tasks_tasks.started_at > NOW() - interval %s'
a8a947
+            % quote(months)
a8a947
         )
a8a947
 
a8a947
         # Populate this dict with DB queries that should be saved directly as
a8a947
-- 
a8a947
2.21.0
a8a947
a8a947
From 40cfbd26a64d33cd3ed87edbf8d2b248d339ad9b Mon Sep 17 00:00:00 2001
a8a947
From: Pavel Moravec <pmoravec@redhat.com>
a8a947
Date: Thu, 5 Dec 2019 14:26:03 +0100
a8a947
Subject: [PATCH] [plugins] improve heuristic for applying --since to
a8a947
 logarchives
a8a947
a8a947
logarchive_pattern treats some configs (e.g. /etc/dbus-1) as log
a8a947
archives, causing --since option will skip collecting them.
a8a947
a8a947
This patch just improves the heuristic by claiming nothing under /etc
a8a947
is a logarchive, and adds a warning to sosreport help.
a8a947
a8a947
Improves: #1847
a8a947
a8a947
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
a8a947
---
a8a947
 man/en/sosreport.1      | 7 +++++--
a8a947
 sos/plugins/__init__.py | 5 ++++-
a8a947
 2 files changed, 9 insertions(+), 3 deletions(-)
a8a947
a8a947
diff --git a/man/en/sosreport.1 b/man/en/sosreport.1
a8a947
index a885d563..75819b6e 100644
a8a947
--- a/man/en/sosreport.1
a8a947
+++ b/man/en/sosreport.1
a8a947
@@ -158,8 +158,11 @@ and including logs in non-default locations. This option may significantly
a8a947
 increase the size of reports.
a8a947
 .TP
a8a947
 .B \--since YYYYMMDD[HHMMSS]
a8a947
-Limits the collection to logs newer than this date.
a8a947
-This also affects \--all-logs. Will pad with 0s if HHMMSS isn't specified.
a8a947
+Limits the collection of log archives to those newer than this date. A log
a8a947
+archive is any file not found in /etc, that has either a numeric or a
a8a947
+compression-type file extension for example ".zip". ".1", ".gz" etc.).
a8a947
+This also affects \--all-logs. The date string will be padded with zeros
a8a947
+if HHMMSS is not specified.
a8a947
 .TP
a8a947
 .B \--allow-system-changes
a8a947
 Run commands even if they can change the system (e.g. load kernel modules).
a8a947
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
a8a947
index b7a47b6a..44ae413d 100644
a8a947
--- a/sos/plugins/__init__.py
a8a947
+++ b/sos/plugins/__init__.py
a8a947
@@ -917,6 +917,7 @@ class Plugin(object):
a8a947
             since = self.get_option('since')
a8a947
 
a8a947
         logarchive_pattern = re.compile(r'.*((\.(zip|gz|bz2|xz))|[-.][\d]+)$')
a8a947
+        configfile_pattern = re.compile(r"^%s/*" % self.join_sysroot("etc"))
a8a947
 
a8a947
         if not self.test_predicate(pred=pred):
a8a947
             self._log_info("skipped copy spec '%s' due to predicate (%s)" %
a8a947
@@ -962,7 +963,9 @@ class Plugin(object):
a8a947
                 """ When --since is passed, or maxage is coming from the
a8a947
                 plugin, we need to filter out older files """
a8a947
 
a8a947
-                if logarchive_pattern.search(path) is None:
a8a947
+                # skip config files or not-logarchive files from the filter
a8a947
+                if ((logarchive_pattern.search(path) is None) or
a8a947
+                   (configfile_pattern.search(path) is not None)):
a8a947
                     return True
a8a947
                 filetime = datetime.fromtimestamp(getmtime(path))
a8a947
                 if ((since and filetime < since) or
a8a947
-- 
a8a947
2.21.0
a8a947