Puppet Class: ipa::server::flushcache

Defined in:
manifests/server/flushcache.pp

Summary

Manage cache flushing

Overview



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'manifests/server/flushcache.pp', line 5

class ipa::server::flushcache {
  assert_private()

  #TODO: nscd should be called on both platforms.
  if fact('os.family') == 'RedHat' {
    $ipa_fluch_cache_cmd = "\
if [ -x /usr/sbin/sss_cache ]; then \
  /usr/sbin/sss_cache -UGNA >/dev/null 2>&1 ; \
else \
  /usr/bin/find /var/lib/sss/db -type f -exec rm -f \"{}\" ; ; \
fi"
  } elsif fact('os.family') == 'Debian' {
    $ipa_fluch_cache_cmd = "\
if [ -x /usr/sbin/nscd ]; then \
  /usr/sbin/nscd -i passwd -i group -i netgroup -i automount >/dev/null 2>&1 ; \
elif [ -x /usr/sbin/sss_cache ]; then \
  /usr/sbin/sss_cache -UGNA >/dev/null 2>&1 ; \
else \
  /usr/bin/find /var/lib/sss/db -type f -exec rm -f \"{}\" ; ; \
fi"
  } else {
    fail('The class ipa::flushcache is only written for RedHat and Debian.')
  }

  exec { 'ipa_flushcache':
    command     => "/bin/bash -c ${ipa_fluch_cache_cmd}",
    returns     => ['0','1','2'],
    refreshonly => true,
  }
}