summaryrefslogtreecommitdiffstats
path: root/ipatests/test_integration/tasks.py
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2013-10-30 10:07:22 +0100
committerPetr Viktorin <pviktori@redhat.com>2013-10-31 13:16:16 +0100
commita4ea378e5123c9883814952df06dfe6482da307d (patch)
tree52d9b6e005747a275ca6ae5f940a8e10758bd8d6 /ipatests/test_integration/tasks.py
parent7bf60455feccbd39c8a4990f682ceed34639460e (diff)
downloadfreeipa.git-a4ea378e5123c9883814952df06dfe6482da307d.tar.gz
freeipa.git-a4ea378e5123c9883814952df06dfe6482da307d.tar.xz
freeipa.git-a4ea378e5123c9883814952df06dfe6482da307d.zip
ipatests: Extend clear_sssd_cache to support non-systemd platforms
Part of: https://fedorahosted.org/freeipa/ticket/3833
Diffstat (limited to 'ipatests/test_integration/tasks.py')
-rw-r--r--ipatests/test_integration/tasks.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index a93a583e..bb7688bc 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -374,12 +374,22 @@ def clear_sssd_cache(host):
Clears SSSD cache by removing the cache files. Restarts SSSD.
"""
- host.run_command(['systemctl', 'stop', 'sssd'])
- host.run_command(['rm', '-rfv', '/var/lib/sss/db/cache_%s.ldb'
- % host.domain.name])
- host.run_command(['rm', '-rfv', '/var/lib/sss/mc/group'])
- host.run_command(['rm', '-rfv', '/var/lib/sss/mc/passwd'])
- host.run_command(['systemctl', 'start', 'sssd'])
+ systemd_available = host.transport.file_exists('/bin/systemctl')
+
+ if systemd_available:
+ host.run_command(['systemctl', 'start', 'sssd'])
+ else:
+ host.run_command(['/sbin/service', 'sssd', 'start'])
+
+ host.run_command("find /var/lib/sss/db -name '*.ldb' | "
+ "xargs rm -fv")
+ host.run_command(['rm', '-fv', '/var/lib/sss/mc/group'])
+ host.run_command(['rm', '-fv', '/var/lib/sss/mc/passwd'])
+
+ if systemd_available:
+ host.run_command(['systemctl', 'start', 'sssd'])
+ else:
+ host.run_command(['/sbin/service', 'sssd', 'start'])
def sync_time(host, server):