Clean out old watcher pause files automatically
authorPeter Palfrader <peter@palfrader.org>
Sat, 11 Mar 2017 09:45:46 +0000 (10:45 +0100)
committerPeter Palfrader <peter@palfrader.org>
Sat, 11 Mar 2017 09:45:46 +0000 (10:45 +0100)
modules/ganeti2/files/cleanup-watcher-pause-file [new file with mode: 0755]
modules/ganeti2/manifests/init.pp

diff --git a/modules/ganeti2/files/cleanup-watcher-pause-file b/modules/ganeti2/files/cleanup-watcher-pause-file
new file mode 100755 (executable)
index 0000000..ea680b5
--- /dev/null
@@ -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
index ca56ab0..cb486df 100644 (file)
@@ -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',
+       }
 }