Issue #3152 has been updated by Andrew Gaffney.

I encountered this same issue today. As a workaround, I added entries like the 
following for files I knew would be managed by non-File resources.

file { "/etc/ssh/authorized_keys/test":
  ensure => present,
}

file { "/etc/yum.repos.d/test.conf":
  ensure => present,
}

These entries have the effect of marking the file as managed without actually 
touching the contents of the file. This keeps them from getting clobbered and 
still allows you to manage them with non-File resources.
----------------------------------------
Bug #3152: resources modifying files should mark these files as managed
https://projects.puppetlabs.com/issues/3152

Author: Marc Fournier
Status: Accepted
Priority: Normal
Assignee: 
Category: file
Target version: unplanned
Affected Puppet version: 0.25.4
Keywords: 
Branch: 


To ensure the content of a directory is managed only by puppet, people
usually define the "recurse, purge, force" parameters on this directory,
then populate it using regular "file" resources.

Unfortunately, non-file resources such as yumrepo, augeas, or
ssh_authorized_key don't get marked as having been created by puppet, and
therefore gets removed by the "recurse, purge, force"-ed parent directory.

The following code snippet reproduces this problem:

<pre>
file { ["/etc/yum.repos.d/", "/etc/ssh/authorized_keys/"]:
  source => "file:///tmp/emptydir/",
  recurse => true, purge => true, force => true,
  require => [Yumrepo["test"], Ssh_authorized_key["test"]],
}

yumrepo { "test": descr => 'foobar' }

ssh_authorized_key { "test":
  type => "rsa", key => 'foobar',
  target => "/etc/ssh/authorized_keys/test",
}
</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://projects.puppetlabs.com/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