Have a look at has_variable? and test on that first then (see puppet template 
docs).

On 15/06/2011, at 23:32, Sans <[email protected]> wrote:

> Doesn't look like there is a "Dir.exists" but "File.exists" appears to
> be working for directory as well. And there is a "File.directory",
> which works as well.
> Two ways of run a check for directories:
> 
> if File.exists?(d_path) && File.directory?(d_path)
> or
> if File.directory?(d_path)
> 
> One thing is: if the directory doesn't exist, I se this error on the
> client:
> 
> err: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Failed to parse template w_nodes/mom_priv-config.tpl: Could
> not find value for 'num_core' at /etc/puppet/modules/w_nodes/manifests/
> init.pp:42 on node myserv.ac.uk
> 
> 
> I do understand the meaning but is it normal? I thought if the above
> directory doesn't exist, it'll simple skip the rest. cheers!!
> 
> 
> On Jun 14, 8:59 pm, "Matthew Black" <[email protected]> wrote:
>> Not sure if it does, I'm going with the assumption it would not.
>> 
>> Though there is a Dir.exists that you could use.
>> 
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]]
>> 
>> On Behalf Of Sans
>> Sent: Tuesday, June 14, 2011 1:54 PM
>> To: Puppet Users
>> Subject: [Puppet Users] Re: how to do conditional check?
>> 
>> On Jun 14, 6:12 pm, "Matthew Black" <[email protected]> wrote:
>>> I haven’t used torque or yaim but what you want to do in a fact is
>> something
>>> like this to determine installation.
>> 
>>> if File.exists?('/path/to/config')
>> 
>> Does it work for directory as well?
>> 
>>  -San
>> 
>> --
> 
> -- 
> 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.
> 

-- 
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.

Reply via email to