Rich Rauenzahn
2011-Feb-15 18:04 UTC
[Puppet Users] Keeping a directory clean at top level
Say we have a directory called /FOO-- we want to only have in it what puppet puts into it. I want to remove any symlinks, empty directories, or files in it that don''t belong -- but only one level deep. If the subdirectory has content, I don''t want it removed -- ideally, I''d like a failure. This is because we might have some systems misconfigured (prior to deploying puppet) and we want to manually fix them -- the content in /FOO/bar might be important. Hmm - maybe this is a case for audit? ...but doesn''t seem to fit what I want to do. Maybe it doesn''t work in command line mode since there isn''t a history recorded. I''ve been trying puppet resource file /tmp/empty_me ensure=directory purge=true source=/tmp/empty recurse=true recurselimit=1 force=true recurselimit=0 does nothing. recurselimit=1 stll causes the directory''s contents to be removed. Without force, empty directories aren''t removed. Without recurse my directory isn''t purged. Any ideas? Is this possible to do without making my own file resource type? -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Feb 15, 10:04 am, Rich Rauenzahn <rraue...@gmail.com> wrote:> Say we have a directory called /FOO-- we want to only have in it what > puppet puts into it....> puppet resource file /tmp/empty_me ensure=directory purge=true > source=/tmp/empty recurse=true recurselimit=1 force=trueI use this pattern myself, something like file { "/tmp/test": ensure => directory, purge => true, recurse => true, recurselimit => 1, force => true; "/tmp/test/foo": ensure => directory; } For your particular case I suspect it''s because your using the resource application, instead of agent or apply. The applied catalog doesn''t have any other managed resources. Using the above snippet /tmp/ test/foo is ignored as a managed resource and can contain anything. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.