aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2020-02-04 16:14:03 +0100
committerJake Hunsaker <jhunsake@redhat.com>2020-02-04 12:59:09 -0500
commit1070f6ed363df51c860e3c15a3e32c3f1adf4292 (patch)
treeef280f591b3358db5e8ce8c8a56278683a59ccba
parenta4111986f7913f17dce69e0ff7099a8035b0cc0d (diff)
downloadsos-1070f6ed363df51c860e3c15a3e32c3f1adf4292.tar.gz
[sssd] call sssctl commands only when sssd service is running
As sssctl timeouts otherwise. Resolves: #1932 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/plugins/sssd.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/sos/plugins/sssd.py b/sos/plugins/sssd.py
index d2c9613f..ea9fdeea 100644
--- a/sos/plugins/sssd.py
+++ b/sos/plugins/sssd.py
@@ -8,7 +8,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+from sos.plugins import (Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin,
+ SoSPredicate)
class Sssd(Plugin):
@@ -28,9 +29,14 @@ class Sssd(Plugin):
"/etc/sssd/conf.d/*.conf"
])
- self.add_cmd_output("sssctl config-check")
+ # call sssctl commands only when sssd service is running,
+ # otherwise the command timeouts
+ sssd_pred = SoSPredicate(self, services=["sssd"])
+ self.add_cmd_output("sssctl config-check", pred=sssd_pred)
- domain = self.collect_cmd_output("sssctl domain-list")
+ # if predicate fails, domain["status"] = None and thus we skip parsing
+ # missing output
+ domain = self.collect_cmd_output("sssctl domain-list", pred=sssd_pred)
if domain['status'] == 0:
for domain_name in domain['output'].splitlines():
self.add_cmd_output("sssctl domain-status -o " + domain_name)