On Mon, Feb 14, 2011 at 6:08 PM, Rich Rauenzahn <rraue...@gmail.com> wrote: > On Mon, Feb 14, 2011 at 5:20 PM, Nan Liu <n...@puppetlabs.com> wrote: >> On Mon, Feb 14, 2011 at 5:17 PM, Rich Rauenzahn <rraue...@gmail.com> wrote: >>> I was surprised to find that >>> >>> file { $foo: >>> ensure => symlink, >>> target => '/tmp/foo', >>> } >>> >>> doesn't replace $foo if $foo is an empty directory. >>> >>> Is there a particular combination of options to the file resource that >>> would replace the directory with the symlink if empty, but wouldn't >>> filebucket the contents and the directory if it wasn't empty? >> >> See http://docs.puppetlabs.com/references/latest/type.html#file >> force => true > > That is what I'm doing. But force also empties the directory if it > has contents. I don't want that.
Sorry missed the details, you can impose this behavior using an exec and make the file resource depend on the exec. The exec will fail for a non empty directory: exec { "remove_empty_dir": command => "rmdir /tmp/foo", path => "/bin:/usr/bin", onlyif => "[ -d /tmp/foo ]", } Thanks, Nan -- 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.