Blob Blame History Raw
From e56b3ea999731b831ebba80cf367e43e65c12b62 Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Mon, 4 Oct 2021 14:43:08 +0200
Subject: [PATCH] [report] Overwrite pred=None before refering predicate
 attributes

During a dry run, add_journal method sets pred=None whilst log_skipped_cmd
refers to predicate attributes. In that case, replace None predicate
by a default / empty predicate.

Resolves: #2711

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
 sos/report/plugins/__init__.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py
index 3c2b64d9..c635b8de 100644
--- a/sos/report/plugins/__init__.py
+++ b/sos/report/plugins/__init__.py
@@ -1693,6 +1693,8 @@ class Plugin():
     def _add_cmd_output(self, **kwargs):
         """Internal helper to add a single command to the collection list."""
         pred = kwargs.pop('pred') if 'pred' in kwargs else SoSPredicate(self)
+        if pred is None:
+            pred = SoSPredicate(self)
         if 'priority' not in kwargs:
             kwargs['priority'] = 10
         if 'changes' not in kwargs:
-- 
2.31.1