Feature #1066

file type; purging a directory requires non-existent source hack

Added by Jeff McCune over 4 years ago. Updated about 4 years ago.

Status:Closed Start date:
Priority:Low Due date:
Assignee:Luke Kanies % Done:

0%

Category:file
Target version:0.25.0
Affected Puppet version:0.25.4 Branch:
Keywords:
Votes: 0

Description

h1. Summary

info and notice messages are generated when using File { purge => true, recurse => true }

h2. Description

As documented in the [FrequentlyAskedQuestions#i-want-to-manage-a-directory-and-purge-its-contents FAQ]

When using something like:

file { "/etc/nagios/conf.d":
  owner   => nagios,
  group   => nagios,
  purge   => true,
  recurse => true,
}

“It seems what most people expect to happen here is create the named directory, set the owner and group, then purge any files or directories that are not managed by puppet underneath that. But this is not the behavior puppet will display. In fact the purge will silently fail.

The workaround is to define a source for the directory that doesn’t exist."

So we must use a non existent source:

file { "/etc/nagios/conf.d":
   owner   => nagios,
   group   => nagios,
   purge   => true,
   recurse => true,
   source  => "/dev/null/nuller",

This is a reasonably acceptable hack, but the problem is the number of log messages:

notice: mount[localhost]: File source /var/should/not/exist/at/all/or/ever does not exist
info: //default/puppet/puppet::server/firewall/File[/etc/sysconfig/iptables.d]/source: No specified sources exist

I haven’t really thought through how this might be solved, but my initial idea of providing a loglevel metaparam and setting it to silence the messages should not be the final solution, because it will mask other “real” problems with the resource.


Possibly related tickets: #543 #789


Related issues

related to Puppet - Bug #2786: Unable to purge a directory in recurse mode if puppet sho... Closed 11/04/2009
related to Puppet - Bug #4537: nagios_* resources interact wrongly with purge-directories Accepted 08/14/2010

History

Updated by James Turnbull over 4 years ago

  • Status changed from 1 to 2

Updated by James Turnbull over 4 years ago

  • Status changed from 2 to 1

Updated by Luke Kanies about 4 years ago

  • Status changed from 1 to Closed
  • 7 set to duplicate

This is essentially a dupe of #1057.

Also available in: Atom PDF