On 09/29/2011 12:38 AM, Sans wrote:
Thanks Peter!
Custom fact is a great idea but the downside is one needs to create a
custom-fact each for every check you wanna perform. Isn't there
anything a bit more dynamic, like checking the location on fly ( bash
equivalent: if [ -d "/var/torque/mom_priv" ]; ) ?? Cheers!!
On Sep 28, 4:33 pm, Peter Bukowinski<pmb...@gmail.com> wrote:
I'd create a custom fact that checks for the existence of the mom_priv
directory -- something like this:
# mom_priv_test.rb
if FileTest.directory?("/var/torque/mom_priv")
Facter.add("mom_priv_test") do
setcode { true }
end
end
#
Now you can use this fact to wrap your file resource in an if statement:
class mom_priv_config {
if $mom_priv_test == 'true' {
file { '/var/torque/mom_priv/config':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => template('w_nodes/mom_priv-config.tpl'),
#notify => Service['pbs_mom'],
}
}
}
Hello,
You can work it around with something like:
exec { 'mkdir -p 0644':
path => "/usr/bin:/usr/sbin:/bin",
unless => "[ -d '/var/torque/mom_priv' ]"
}
Hope this helps.
--
Dominik Zyla
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.