Feature #1066
file type; purging a directory requires non-existent source hack
| Status: | Closed | Start date: | ||
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assignee: | % 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.
Related issues
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.