* Sans <r.santanu.das at gmail.com> [2011/06/13 02:21]:
> Any suggestion from anyone else? Is there a way to check "if a
> directory (or file) already exists, then do something" in Puppet?
> Cheers!!

I use this pattern:

  $_exists = inline_template("<%= File.exists?('$f') %>")
  case $_exists {
      "true": { ... }
      "false": { ... }
  }

I probably use it too much, in fact, but writing a custom fact for
every file I need to check becomes tedious and hard to maintain (we
do this in quite a few places).

For things like this, irb and inline_template are your friends.

-- 
It's not what you look at that matters, it's what you see.
    -- Henry David Thoreau

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

Reply via email to