summaryrefslogtreecommitdiff
path: root/manifests/cron
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2011-03-15 18:29:51 -0400
committerMicah Anderson <micah@riseup.net>2011-03-15 18:29:51 -0400
commit8aaf0f8b167702dd2b8e4d7e01b33d5915cf4f3b (patch)
tree8c0bc66ab1e471b640d50b7c6cac7191ee844cc5 /manifests/cron
parentd38e7cf64902ff55138e5f85cc7c3b880ea5fb74 (diff)
change the cronjob so that the failure to find any (^err:|^alert:|^emerg:|^crit:) in the output from the puppet run doesn't leave us with a '1' return code from grep.
On Debian Squeeze systems, this problem would result in cron reporting that the cron command failed with an exit status 1: /USR/SBIN/CRON[24107]: (CRON) error (grandchild #24108 failed with exit status 1) This was because grep returns a '1' if it fails to find a match. We don't want the failure to find failure messages to produce a failure, so this checks the return code of the grep and fixes it to be '0' if there were no such failure log messages. This is a bit ugly, if you ask me. We are already, unfortunately, swallowing the puppetd return code with the grep. It seems like these sorts of log messages should be retrieved via reports, logcheck, or something other than this grep of the output of the cronjob.
Diffstat (limited to 'manifests/cron')
-rw-r--r--manifests/cron/linux.pp2
1 files changed, 1 insertions, 1 deletions
diff --git a/manifests/cron/linux.pp b/manifests/cron/linux.pp
index b3a10aa..5f8ac98 100644
--- a/manifests/cron/linux.pp
+++ b/manifests/cron/linux.pp
@@ -14,7 +14,7 @@ class puppet::cron::linux inherits puppet::linux {
File['/etc/cron.d/puppetd.cron']{
source => undef,
- content => "# run puppet\n$puppet_crontime root /usr/sbin/puppetd --onetime --no-daemonize --config=$puppet_config --color false $puppet_http_compression_str | grep -E '(^err:|^alert:|^emerg:|^crit:)'\n",
+ content => "# run puppet\n$puppet_crontime root /usr/sbin/puppetd --onetime --no-daemonize --config=$puppet_config --color false $puppet_http_compression_str | grep -E '(^err:|^alert:|^emerg:|^crit:)'; if [ $? -eq 1 ]; then exit 0; fi\n",
before => Service['puppet'],
}
}