Issue #5981 has been updated by vichharaks ros.

we fixed the problem on our host by modifying file 
/usr/lib/ruby/site_ruby/1.8/puppet/type/file.rb

# diff file.rb file.rb.patch
723a724,733
>     if File.lstat(self[:path]).symlink?
>        filename=File.readlink(self[:path])
>        while File.lstat(filename).symlink? do
>         filename=File.readlink(filename)
>        end
>     else
>        filename=self[:path]
>     end
>
>
728c738
<         File.rename(path, self[:path])
---
>         File.rename(path, filename)

We also fixed the problem for puppet version 0.25.4
# diff file.rb file.rb.patch
734a735,743
>     if File.lstat(self[:path]).symlink?
>        filename=File.readlink(self[:path])
>        while File.lstat(filename).symlink? do
>         filename=File.readlink(filename)
>        end
>     else
>        filename=self[:path]
>     end
>
739c748
<                     File.rename(path, self[:path])
---
>                     File.rename(path, filename)

----------------------------------------
Bug #5981: Puppet shouldn't overwrite symlinks when specifying content and 
follow is on.
https://projects.puppetlabs.com/issues/5981

Author: Nigel Kersten
Status: Accepted
Priority: High
Assignee: 
Category: 
Target version: 2.6.x
Affected Puppet version: 
Keywords: 
Branch: 


Illustration of the issue:
<pre>
kripke:~ nbk$ echo "target" > /tmp/target
kripke:~ nbk$ ln -s /tmp/target /tmp/symlink
kripke:~ nbk$ ls -l /tmp/target /tmp/symlink
lrwxr-xr-x  1 nbk  wheel  11 Jan 23 14:43 /tmp/symlink -> /tmp/target
-rw-r--r--  1 nbk  wheel   7 Jan 23 14:43 /tmp/target
</pre>

<pre>

kripke:~ nbk$ puppet --version
2.6.4
kripke:~ nbk$ cat /tmp/test.pp 
file { "/tmp/symlink":
  ensure  => present,
  backup  => false,
  links   => follow,
  content => "content",
}

kripke:~ nbk$ puppet apply -v /tmp/test.pp 
info: Applying configuration version '1295823089'
notice: /Stage[main]//File[/tmp/symlink]/content: content changed 
'{md5}80fb1dd0b20823f1d83e10d25840e2e4' to 
'{md5}9a0364b9e99bb480dd25e1f0284c8555'
kripke:~ nbk$ ls -la /tmp/target /tmp/symlink
-rw-r--r--  1 nbk  wheel  7 Jan 23 14:51 /tmp/symlink
-rw-r--r--  1 nbk  wheel  7 Jan 23 14:47 /tmp/target
</pre>

So even though we're not managing the symlink, and we've only got ensure set to 
"present", and we have links set to follow, Puppet overwrites the symlink with 
the contents, rather than the target.


-- 
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