Hi,
The cron type does not handle lines containing assignement of environement variables. From the man page here is the syntax :
An active line in a crontab will be either an environment setting or a cron command. An environment setting
is of the form,
name = value
where the spaces around the equal-sign (=) are optional, and any subsequent non-leading spaces in value will
be part of the value assigned to name. The value string may be placed in quotes (single or double, but match-
ing) to preserve leading or trailing blanks. The value string is not parsed for environmental substitutions,
thus lines like
PATH = $HOME/bin:$PATH
will not work as you might expect.
Several environment variables are set up automatically by the cron(8) daemon. SHELL is set to /bin/sh, and
LOGNAME and HOME are set from the /etc/passwd line of the crontab's owner. PATH is set to "/usr/bin:/bin".
HOME, SHELL, and PATH may be overridden by settings in the crontab; LOGNAME is the user that the job is run-
ning from, and may not be changed.
(Another note: the LOGNAME variable is sometimes called USER on BSD systems... on these systems, USER will be
set also.)
In addition to LOGNAME, HOME, and SHELL, cron(8) will look at MAILTO if it has any reason to send mail as a
result of running commands in this crontab. If MAILTO is defined (and non-empty), mail is sent to the
user so named. If MAILTO is defined but empty (MAILTO=""), no mail will be sent. Otherwise mail is sent to
the owner of the crontab.
right now the puppetd throw an error when encountering this legal lines:
core1:/root%(root)> puppetd --server xxxx.xxx --waitforcert 60 --test
info: Caching configuration at /etc/puppet/localconfig.yaml
info: No classes to store
info: file=/usr/local/lib/ruby/1.8/facter/local.rb: Adding aliases facterlocal
notice: Starting configuration run
err: Could not apply complete configuration: Could not match 'TZ=Europe/Paris'
notice: Finished configuration run in 0.18 seconds
core1:/root%(root)>
So it should be corrected to :
1/ do not fail on those lines
2/ add to the cron object the capability to add such assignement
particulary the assignement should be able to build such lines:
MAILTO=ghislain@haque0s.com
* * * * * echo 'hello ghislain'
MAILTO=luke@madstip.com
* * * * * echo 'use the force, Luke'
it mean add the line in the order we need as the MAILTO lines will not be usefull if it is AFTER the cronline and not before. For exemple :
cron { puppetcron:
command => "puppetd --server $puppetserver --onetime",
user => root,
hour => 2,
minute => 0,
assignname => "MAILTO",
assignvalue => "myname@here.com",
assign => "before"
}
it could be handy to have the possibility to add a line at the start of the crontab like this :
cron { mailto:
assignname => "MAILTO",
assignvalue => "myname@here.com",
assign => "firstline"
}
so all output of all this crontab will be send to the adress specified.
best regards,
Ghislain.