sos/SOURCES/sos-bz1985986-potential-issues-static-analyse.patch

66 lines
2.3 KiB
Diff
Raw Normal View History

2021-10-06 14:53:48 +00:00
From 6d5cbe90e17534d53d7fe42dff4d8ca734acf594 Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
Date: Tue, 29 Jun 2021 15:49:00 -0400
Subject: [PATCH] [yum] Fix potential traceback when yum history is empty
Like we did in #969 for `dnf`, fix a potential issue where we would
generate a traceback in the plugin when `yum history` is empty.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
sos/report/plugins/yum.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sos/report/plugins/yum.py b/sos/report/plugins/yum.py
index 54e222df..aec805e6 100644
--- a/sos/report/plugins/yum.py
+++ b/sos/report/plugins/yum.py
@@ -91,7 +91,7 @@ class Yum(Plugin, RedHatPlugin):
# packages installed/erased/updated per transaction
if self.get_option("yum-history-info"):
history = self.exec_cmd("yum history")
- transactions = None
+ transactions = -1
if history['status'] == 0:
for line in history['output'].splitlines():
try:
--
2.31.1
From a7a4ef73faee6cddba36bf670d4a20ab0521c36f Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Wed, 30 Jun 2021 13:10:56 +0200
Subject: [PATCH] [plugins] Set default predicate instead of None for
robustness
Just making the code more robustness, it could be dangerous to
set pred = None and then potentially call log_skipped_cmd that
expects "pred" of SoSPredicate type.
Currently such a call flow can not happen, but it is worth to
make the code more robust for potential future changes.
Resolves: #2601
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
sos/report/plugins/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py
index 6fd1a3b2..b9cd28ed 100644
--- a/sos/report/plugins/__init__.py
+++ b/sos/report/plugins/__init__.py
@@ -1629,7 +1629,7 @@ class Plugin(object):
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 None
+ pred = kwargs.pop('pred') if 'pred' in kwargs else SoSPredicate(self)
soscmd = SoSCommand(**kwargs)
self._log_debug("packed command: " + soscmd.__str__())
for _skip_cmd in self.skip_commands:
--
2.31.1