Issue #1572 has been updated by luke.

Status changed from Accepted to Ready for Checkin
Assigned to changed from andrew to jamtur01

Fixed in the tickets/0.24.x/1572 branch in my repo.
----------------------------------------
Bug #1572: File resource with recurse => true, purge => true removes content of 
directory when source is unavailable 
http://projects.reductivelabs.com/issues/show/1572

Author: ssm
Status: Ready for Checkin
Priority: Urgent
Assigned to: jamtur01
Category: file
Target version: 0.24.6
Complexity: Unknown
Affected version: 0.24.5
Keywords: file
directory
recurse
purge


h1. Description

When a file resource is listed with recurse => true, and purge => true, and the 
source is unavailable, puppet will remove all content from the destination 
directory.

(In our case, a fact was missing, and a variable from the fact was used in the 
source path name)

I would expect puppet to remove content from the destination directory only if 
puppet can verify that the source directory exists, and is empty.

h1. To reproduce:

h2. Run puppet with the following recipe to create a source:

<pre>
    file {["/tmp/ssm","/tmp/ssm/source"]:
        ensure => directory,
    }
    file {["/tmp/ssm/source/one","/tmp/ssm/source/two"]:
        ensure  => present,
        content => "diddly-squat"
    }
</pre>

h2. Copy source to destination

<pre>
    file {"/tmp/ssm/destination":
        ensure  => directory,
        recurse => true,
        purge   => true,
        source  => "/tmp/ssm/source",
        require => Class["create_source"]
    }
</pre>

h2. Copy source to destination, with a simulatet missing or unavailable source 
(like a $variable in the source name being empty)

<pre>
    file {"/tmp/ssm/destination":
        ensure  => directory,
        recurse => true,
        purge   => true,
        source  => "/tmp/ssm/missing_source",
        require => Class["create_source"]
    }
</pre>

h1. Sample output

Output from run from the attached manifest (like the quoted ones above, just 
wrapped in classes):
<pre>
notice: //create_source/File[/tmp/ssm]/ensure: created
notice: //create_source/File[/tmp/ssm/source]/ensure: created
notice: //create_source/File[/tmp/ssm/source/one]/ensure: changed file contents 
from {md5}d4d36ee0f4852fc068b79561a4e5e65e to 
{md5}d4d36ee0f4852fc068b79561a4e5e65e
notice: //create_source/File[/tmp/ssm/source/two]/ensure: changed file contents 
from {md5}d4d36ee0f4852fc068b79561a4e5e65e to 
{md5}d4d36ee0f4852fc068b79561a4e5e65e
notice: //copy_from_source/File[/tmp/ssm/destination]/ensure: created
notice: //copy_from_source/File[/tmp/ssm/destination/one]/ensure: created
notice: //copy_from_source/File[/tmp/ssm/destination/two]/ensure: created
</pre>

Output from run after substituting "copy_from_source" with 
"copy_from_missing_source"
<pre>
err: //copy_from_missing_source/File[/tmp/ssm/destination]: Failed to retrieve 
current state of resource: No specified source was found from 
/tmp/ssm/missing_source
notice: //copy_from_missing_source/File[/tmp/ssm/destination/one]/ensure: 
removed
notice: //copy_from_missing_source/File[/tmp/ssm/destination/two]/ensure: 
removed
</pre>



----------------------------------------
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to