Revision c6ccba7e daemons/ganeti-cleaner.in

b/daemons/ganeti-cleaner.in
32 32
  xargs -r0 rm -vf
33 33
}
34 34

  
35
cleanup_node() {
36
  # Return if directory for crypto keys doesn't exist
37
  [[ -d $CRYPTO_DIR ]] || return 0
38

  
39
  find $CRYPTO_DIR -mindepth 1 -maxdepth 1 -type d | \
40
  while read dir; do
41
    if $CHECK_CERT_EXPIRED $dir/cert; then
42
      rm -vf $dir/{cert,key}
43
      rmdir -v --ignore-fail-on-non-empty $dir
44
    fi
45
  done
46
}
47

  
35 48
DATA_DIR=@LOCALSTATEDIR@/lib/ganeti
36 49
CLEANER_LOG_DIR=@LOCALSTATEDIR@/log/ganeti/cleaner
37 50
QUEUE_ARCHIVE_DIR=$DATA_DIR/queue/archive
51
CRYPTO_DIR=@LOCALSTATEDIR@/run/ganeti/crypto
52
CHECK_CERT_EXPIRED=@PKGLIBDIR@/check-cert-expired
38 53

  
39 54
# Define how many days archived jobs should be left alone
40 55
REMOVE_AFTER=21
......
58 73
xargs -r rm -vf
59 74

  
60 75
cleanup_master
76
cleanup_node
61 77

  
62 78
exit 0

Also available in: Unified diff