aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2021-07-26 10:25:16 +0200
committerJake Hunsaker <jhunsake@redhat.com>2021-07-26 10:20:07 -0400
commiteaac4ae4d92094a4242b3ea5357278296eaaf41a (patch)
tree715fbd2f0f3cd778c3f298c7d72c1fb09fcc40dd
parentac62d5d6a1b49d161777e31724f944e3d1093160 (diff)
downloadsos-eaac4ae4d92094a4242b3ea5357278296eaaf41a.tar.gz
[report] Improve logging skipped commands during dry run
Set default value for the attribute 'changes' when_add_cmd_output is called without that argument. Further, add reason to "skipped command" log due to --dry-run. Resolves: #2626 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r--sos/report/plugins/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py
index 8c9e5f3a..1bc7b6fe 100644
--- a/sos/report/plugins/__init__.py
+++ b/sos/report/plugins/__init__.py
@@ -326,7 +326,11 @@ class SoSPredicate(object):
"""Used by `Plugin()` to obtain the error string based on if the reason
was a failed check or a forbidden check
"""
- msg = [self._report_failed(), self._report_forbidden()]
+ msg = [
+ self._report_failed(),
+ self._report_forbidden(),
+ '(dry run)' if self.dry_run else ''
+ ]
return " ".join(msg).lstrip()
def __nonzero__(self):
@@ -1633,6 +1637,8 @@ class Plugin(object):
pred = kwargs.pop('pred') if 'pred' in kwargs else SoSPredicate(self)
if 'priority' not in kwargs:
kwargs['priority'] = 10
+ if 'changes' not in kwargs:
+ kwargs['changes'] = False
soscmd = SoSCommand(**kwargs)
self._log_debug("packed command: " + soscmd.__str__())
for _skip_cmd in self.skip_commands: