From: Peter Palfrader Date: Sat, 11 Mar 2017 09:45:46 +0000 (+0100) Subject: Clean out old watcher pause files automatically X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=f7278bfb87b71ce89849f9607a460e03893fb412;p=mirror%2Fdsa-puppet.git Clean out old watcher pause files automatically --- diff --git a/modules/ganeti2/files/cleanup-watcher-pause-file b/modules/ganeti2/files/cleanup-watcher-pause-file new file mode 100755 index 000000000..ea680b5e3 --- /dev/null +++ b/modules/ganeti2/files/cleanup-watcher-pause-file @@ -0,0 +1,18 @@ +#!/bin/sh + +set -e +set -u + +P=/var/lib/ganeti/watcher.pause +SKEW=1800 + +if [ -e "$P" ]; then + until="$(cat "$P")" + deleteafter=$(( until + SKEW )) + + now="$(date +%s)" + + if [ "$deleteafter" -gt "$now" ]; then + rm "$P" + fi +fi diff --git a/modules/ganeti2/manifests/init.pp b/modules/ganeti2/manifests/init.pp index ca56ab071..cb486dfd5 100644 --- a/modules/ganeti2/manifests/init.pp +++ b/modules/ganeti2/manifests/init.pp @@ -17,6 +17,10 @@ class ganeti2 { ensure => installed } - site::linux_module { 'tun': } + + file { '/etc/cron.hourly/puppet-cleanup-watcher-pause-file': + source => 'puppet:///modules/ganeti2/cleanup-watcher-pause-file', + mode => '0555', + } }