On 04/24/10 00:47, Eric Sorenson wrote:
rlpowell mentioned this earlier on irc and i find myself in a similar
boat - I need to express a condition that doesn't fit neatly into the
class/parameter model and I'm not quite sure how to do it. i'd like
to add a cron entry IFF a particular file (not managed through puppet)
exists.
Someone else just posted an alternative way to solve it, which works
well for cron jobs, where you let the cron job itself check if the
script exists. For the more general problem, though, a custom fact
is the proper way to do that. Something like:
Facter.add('run_this_script_exists') do
setcode do
File.exist?("/run/this/script.sh") ? "true" : ""
end
end
And then use it like this:
if $run_this_script_exists {
cron {
"myjob": ...
}
}
There are some plans to add 'onlyif' and 'unless' as metaparameters
that would work on all resource types. (Today those 'onlyif' and
'unless' only exists for the 'exec' type.) However, for now custom
facts is the only way to do it.
/Bellman
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.