Bug #1503
puppet client - require recursive purge directory does not work
| Status: | Rejected | Start date: | 08/11/2008 | |
|---|---|---|---|---|
| Priority: | High | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | file | |||
| Target version: | 0.24.6 | |||
| Affected Puppet version: | 0.24.5 | Branch: | ||
| Keywords: | puppetd | |||
| Votes: | 0 |
Description
Seeing this in the wiki: http://reductivelabs.com/trac/puppet/wiki/FrequentlyAskedQuestions#i-want-to-manage-a-directory-and-purge-its-contents
Some user tried it, but required the dir to be purged before adding new files, asked why it did not work on irc, tested it myself, did not succeed either with puppetd 0.24.5 (works with puppetd 0.24.4) In the newer puppetd a resource that does not exist gives a failure (while before it was only like a warning) so if you require this further down your recipe then it fails completely.
An example:
puppetmaster version 0.24.5
puppetclient filesystem:¶
mkdir -p /root/dirtopurge/junkdir1¶
touch /root/dirtopurge/junkfile2¶
puppetmaster class:¶
class purgedir { file { “/root/dirtopurge”:
owner => root,
group => root,
purge => true,
recurse => true,
force => true,
source => "puppet://puppet/files/root/empty", #empty does not exist on fileserver, just a dummy to make it purge
} file {“/root/newfile”:
owner => root,
group => root,
mode => 644,
require => File["/root/dirtopurge"],
source => "puppet://puppet/files/root/newfile" #newfile does exist on fileserver
} }
puppetclient 0.24.5 messages log:¶
Aug 10 17:05:16 puppetclient puppetd[3316]: Starting catalog run Aug 10 17:05:16 puppetclient puppetd[3316]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/dirtopurge]) Failed to retrieve current state of resource: No specified source was found from puppet://puppet/files/root/empty Aug 10 17:05:16 puppetclient puppetd[3316]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/dirtopurge/junkdir1]/ensure) removed Aug 10 17:05:16 puppetclient puppetd[3316]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/dirtopurge/junkfile2]/ensure) removed Aug 10 17:05:16 puppetclient puppetd[3316]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/newfile]) Dependency file[/root/dirtopurge] has 1 failures Aug 10 17:05:16 puppetclient puppetd[3316]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/newfile]) Skipping because of failed dependencies Aug 10 17:05:16 puppetclient puppetd[3316]: Finished catalog run in 0.38 seconds
dirtopurge is empty but /root/newfile was not created
puppetclient 0.24.4 messages log:¶
Aug 10 17:06:50 puppetclient puppetd[3918]: Starting catalog run Aug 10 17:06:51 puppetclient puppetd[3918]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/dirtopurge]/ensure) No specified sources exist Aug 10 17:06:51 puppetclient puppetd[3918]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/dirtopurge]/ensure) No specified sources exist Aug 10 17:06:51 puppetclient puppetd[3918]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/dirtopurge]/source) No specified sources exist Aug 10 17:06:51 puppetclient puppetd[3918]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/dirtopurge]/checksum) checksum changed ‘{mtime}Sun Aug 10 17:05:16 +0200 2008’ to ‘{mtime}Sun Aug 10 17:06:46 +0200 2008’ Aug 10 17:06:51 puppetclient puppetd[3918]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/dirtopurge/junk1]/ensure) removed Aug 10 17:06:51 puppetclient puppetd[3918]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/dirtopurge/junkdir]/ensure) removed Aug 10 17:06:51 puppetclient puppetd[3918]: (//Node[puppetclient.homenet.lan]/purgedir/File[/root/newfile]/ensure) created Aug 10 17:06:51 puppetclient puppetd[3918]: Finished catalog run in 0.71 seconds
dirtopurge is empty and /root/newfile is created
Related issues
History
Updated by Luke Kanies over 3 years ago
- Category set to file
- Status changed from Unreviewed to Accepted
- Target version set to 0.24.6
Updated by James Turnbull over 3 years ago
- Priority changed from Normal to High
Updated by Luke Kanies over 3 years ago
- Status changed from Accepted to Rejected
This is intended behaviour — /root/newfile has a failed dependency, so it won’t be applied. If you want this kind of behaviour, create a server-side empty directory and use it as the source of your copy.