|
|
30a705 |
From 903958306830ea00ac47e3ea353eaa5d8abbacb6 Mon Sep 17 00:00:00 2001
|
|
|
30a705 |
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
|
30a705 |
Date: Wed, 23 Oct 2019 14:24:59 -0400
|
|
|
30a705 |
Subject: [PATCH] [Predicate] Override __bool__ to allow py3 evaluation
|
|
|
30a705 |
|
|
|
30a705 |
The check in `Plugin.test_predicate()` relies on a 'is not None' test,
|
|
|
30a705 |
which on py2 invokes a call to `SoSPredicate.__nonzero__()` which in
|
|
|
30a705 |
turns runs our evaluation of the predicate. On py3 however, this test is
|
|
|
30a705 |
an explicit check to see if the object is `NoneType`. As such,
|
|
|
30a705 |
`__nonzero__()` never runs and the predicate defaults to always
|
|
|
30a705 |
evaluating ad `True`. This effectively removed any gating for command
|
|
|
30a705 |
execution on py3.
|
|
|
30a705 |
|
|
|
30a705 |
By overriding `SoSPredicate.__bool__()` to wrap `__nonzero__()` we can
|
|
|
30a705 |
ensure that predicate evaluation is performed properly on both py2 and
|
|
|
30a705 |
py3 runtimes.
|
|
|
30a705 |
|
|
|
30a705 |
Closes: #1839
|
|
|
30a705 |
Resolves: #1840
|
|
|
30a705 |
|
|
|
30a705 |
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
|
30a705 |
---
|
|
|
30a705 |
sos/plugins/__init__.py | 5 +++++
|
|
|
30a705 |
1 file changed, 5 insertions(+)
|
|
|
30a705 |
|
|
|
30a705 |
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
|
30a705 |
index ed55ea382..7ed75a5cc 100644
|
|
|
30a705 |
--- a/sos/plugins/__init__.py
|
|
|
30a705 |
+++ b/sos/plugins/__init__.py
|
|
|
30a705 |
@@ -181,6 +181,11 @@ class SoSPredicate(object):
|
|
|
30a705 |
return ((self._eval_kmods() and self._eval_services()) and not
|
|
|
30a705 |
self.dry_run)
|
|
|
30a705 |
|
|
|
30a705 |
+ def __bool__(self):
|
|
|
30a705 |
+ # Py3 evaluation ends in a __bool__() call where py2 ends in a call
|
|
|
30a705 |
+ # to __nonzero__(). Wrap the latter here, to support both versions
|
|
|
30a705 |
+ return self.__nonzero__()
|
|
|
30a705 |
+
|
|
|
30a705 |
def __init__(self, owner, dry_run=False, kmods=[], services=[],
|
|
|
30a705 |
required={}):
|
|
|
30a705 |
"""Initialise a new SoSPredicate object.
|
|
|
30a705 |
From 4c02a77a1c0403c903c835d85739a6213c1a2287 Mon Sep 17 00:00:00 2001
|
|
|
30a705 |
From: Pavel Moravec <pmoravec@redhat.com>
|
|
|
30a705 |
Date: Tue, 5 Nov 2019 17:29:57 +0100
|
|
|
30a705 |
Subject: [PATCH] [man] describe --allow-system-changes
|
|
|
30a705 |
|
|
|
30a705 |
In #1435, --allow-system-changes option was added that is documented
|
|
|
30a705 |
in sosreport --help but not in manpages.
|
|
|
30a705 |
|
|
|
30a705 |
Resolves: #1850
|
|
|
30a705 |
|
|
|
30a705 |
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
|
|
|
30a705 |
---
|
|
|
30a705 |
man/en/sosreport.1 | 4 ++++
|
|
|
30a705 |
1 file changed, 4 insertions(+)
|
|
|
30a705 |
|
|
|
30a705 |
diff --git a/man/en/sosreport.1 b/man/en/sosreport.1
|
|
|
30a705 |
index 649cba04d..a885d5630 100644
|
|
|
30a705 |
--- a/man/en/sosreport.1
|
|
|
30a705 |
+++ b/man/en/sosreport.1
|
|
|
30a705 |
@@ -25,6 +25,7 @@ sosreport \- Collect and package diagnostic and support data
|
|
|
30a705 |
[--log-size]\fR
|
|
|
30a705 |
[--all-logs]\fR
|
|
|
30a705 |
[--since YYYYMMDD[HHMMSS]]\fR
|
|
|
30a705 |
+ [--allow-system-changes]\fR
|
|
|
30a705 |
[-z|--compression-type method]\fR
|
|
|
30a705 |
[--encrypt-key KEY]\fR
|
|
|
30a705 |
[--encrypt-pass PASS]\fR
|
|
|
30a705 |
@@ -160,6 +161,9 @@ increase the size of reports.
|
|
|
30a705 |
Limits the collection to logs newer than this date.
|
|
|
30a705 |
This also affects \--all-logs. Will pad with 0s if HHMMSS isn't specified.
|
|
|
30a705 |
.TP
|
|
|
30a705 |
+.B \--allow-system-changes
|
|
|
30a705 |
+Run commands even if they can change the system (e.g. load kernel modules).
|
|
|
30a705 |
+.TP
|
|
|
30a705 |
.B \-z, \--compression-type METHOD
|
|
|
30a705 |
Override the default compression type specified by the active policy.
|
|
|
30a705 |
.TP
|