Bug #709
crontab type seems to detect the current environment lines wrong
| Status: | Accepted | Start date: | ||
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | cron | |||
| Target version: | 2.7.x | |||
| Affected Puppet version: | 0.24.7 | Branch: | ||
| Keywords: | cronfixit | |||
| Votes: | 0 |
Description
notice: //node1/baseserverrole/webserverrole/webcron/rcron[ntpd_check]/Cron[ntpd_check]/environment: environment changed 'MAILTO=email@mydomain.com,MAILTO=email@mydomain.com,MAILTO=email@mydomain.com,MAILTO=email@mydomain.com,MAILTO=email@mydomain.com,MAILTO=email@mydomain.com,MAILTO=email@mydomain.com,MAILTO=email@mydomain.com,MAILTO=email@mydomain.com,MAILTO=email@mydomain.com' to 'MAILTO=email@mydomain.com'
The cron provider seems to think there are more MAILTO’s then actually are. As listing the crontab shows:
# Puppet Name: ntpd_check MAILTO=email@mydomain.com */5 * * * * /root/bin/ntpmon > /dev/null 2>&1
This happens everytime puppetd —test is run.
puppet config:
rCron{ ntpd_check:
command=>"/root/bin/ntpmon > /dev/null 2>&1",
minute=>"*/5",
require=>RFile[[rootbinntpmon]]
}
define rCron($command,$minute=absent,$hour=absent,$monthday=absent,$month=absent,$weekday=absent,$environment="MAILTO=email@mydomain.com"){
cron{ $name:
command=>$command,
minute=>$minute,
hour=>$hour,
month=>$month,
monthday=>$monthday,
weekday=>$weekday,
environment=>$environment,
user=>root
}
}
Related issues
History
Updated by Luke Kanies almost 5 years ago
- Status changed from 1 to Closed
- 7 set to fixed
I expect this was fixed in #705.
Updated by micah - over 3 years ago
- Category set to cron
- Status changed from Closed to Re-opened
- Affected Puppet version set to 0.24.7
This is an ancient bug, but I am seeing it now. Every run I get this message:
Jan 2 06:22:30 spamd2 puppetd[30676]: (//Nodecommit:spamd2]/spamd/Cron[sa-update_openprotect/environment) environment changed 'TMPDIR=/var/tmp,TMP=/var/tmp' to 'TMPDIR=/var/tmp TMP=/var/tmp'
Although the crontab itself doesn’t show that the environment is set that way:
# HEADER: This file was autogenerated at Fri Jan 02 09:00:02 -0800 2009 by puppet. # HEADER: While it can still be managed manually, it is definitely not recommended. # HEADER: Note particularly that the comments starting with 'Puppet Name' should # HEADER: not be deleted, as doing so could cause duplicate cron jobs. # m h dom mon dow command # Puppet Name: sa-update_openprotect TMPDIR=/var/tmp TMP=/var/tmp 0 2 * * * sa-update --gpgkeyfile /etc/spamassassin/sa-update_gpgkeys --channelfile /etc/spamassassin/sa-update_channels && sa-compile &>/dev/null && /etc/init.d/spamassassin restart &>/dev/null # Puppet Name: bayes_expire 0 3 * * * sa-learn --sync --force-expire >/dev/null 2>&1 # Puppet Name: spamassassin_munin */5 * * * * /usr/local/bin/spamassasin_munin # Puppet Name: update_root_hints PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 0 3 27 * * /usr/local/sbin/roothints_update.sh
The actual puppet snippet is:
cron {
"sa-update_openprotect":
command => "sa-update --gpgkeyfile /etc/spamassassin/sa-update_gpgkeys --channelfile /etc/spamassassin/sa-update_channels && sa-compile &>/dev/null && /etc/init.d/spamassassin restart &>/dev/null",
environment => "TMPDIR=/var/tmp\nTMP=/var/tmp",
user => root,
hour => 2,
minute => 0;
# Because we are turning auto_expire off in the spamassassin local.cf, we need to do it here, see comments in local.cf as to why we are doing this
"bayes_expire":
command => "sa-learn --sync --force-expire >/dev/null 2>&1",
user => root,
hour => 3,
minute => 0;
"spamassassin_munin":
command => "/usr/local/bin/spamassasin_munin",
user => root,
minute => '*/5';
}
This particular error is coming about because I first setup this cron line incorrectly, and then changed it:
@@ -57,7 +57,7 @@ class spamd {
cron {
"sa-update_openprotect":
command => "sa-update --gpgkeyfile /etc/spamassassin/sa-update_gpgkeys --channelfile /etc/spamassassin/sa-update_channels && sa-compile &>/dev/null && /etc/init.d/spamassassin restart &>/dev/null",
- environment => '["TMPDIR=/var/tmp", "TMP=/var/tmp"]',
+ environment => "TMPDIR=/var/tmp\nTMP=/var/tmp",
user => root,
hour => 2,
minute => 0;
The replaced line was incorrect, which generated other errors of course, but this particular error started happening after I fixed it with what is shown above.
Updated by Luke Kanies about 2 years ago
- Assignee deleted (
Luke Kanies) - Target version set to 2.7.x
I see a cron sweep in our future.
Updated by James Turnbull almost 2 years ago
- Status changed from Re-opened to Accepted
Updated by Nigel Kersten over 1 year ago
- Keywords set to cronfixit