Issue #21659 has been updated by Arnoud de Jonge.
The code that checks the filetype uses File.stat(file).type. This for some
reason returns that it is a file:
irb(main):001:0> File.stat('wellthisisembarrasing').ftype
=> "file"
File.ftype(file) return the correct value:
irb(main):002:0> File.ftype('wellthisisembarrasing')
=> "link"
Will make a PR.
----------------------------------------
Bug #21659: ensure => 'absent' on a symlink will filebucket the target of the
symlink
https://projects.puppetlabs.com/issues/21659#change-94582
* Author: Jason Birch
* Status: Investigating
* Priority: Normal
* Assignee: Arnoud de Jonge
* Category: filebucket
* Target version:
* Affected Puppet version: 3.1.1
* Keywords: filebucket symlink absent
* Branch:
----------------------------------------
If a file resource has the clause `ensure => 'absent'`, and the resource title
(or path) refers to a symlink to a regular file, applying the puppet manifest
will filebucket the destination file before removing the symlink. This
behaviour is not observed on symlinks to special files, like /dev/random.
We then see some hilarious behaviour if there is a symlink to a large file.
While we'd ideally like puppet to release there is a link to a file that there
shouldn't be, not care anything about the target or content thereof, and simply
remove the symlink itself, we get unneeded and unintended processing.
Puppet seems fully aware that it is removing a link, thought it still
filebuckets the destination unnecessarily.
$ dd if=/dev/urandom of=dest bs=64M count=32
$ ln -s dest wellthisisembarrasing
file { '/home/puppet/wellthisisembarrasing':
ensure => 'absent',
purge => true,
force => true,
}
Info: FileBucket adding {md5}c12d93b72ad1613a3b1ef4f0a5d1b3e4
Info: /File[/home/puppet/wellthisisembarrasing]: Filebucketed
/home/puppet/wellthisisembarrasing to puppet with sum
c12d93b72ad1613a3b1ef4f0a5d1b3e4
Debug: /File[/home/puppet/wellthisisembarrasing]: Removing existing link
for replacement with absent
Notice: /File[/home/puppet/wellthisisembarrasing]/ensure: removed
It also takes a long time to both md5 the file, and then to transfer the
contents to the filebucket.
$ time md5sum dest
c12d93b72ad1613a3b1ef4f0a5d1b3e4 dest
real 0m4.620s
user 0m4.021s
sys 0m0.460s
$ time cp dest copy
real 0m13.202s
user 0m0.015s
sys 0m2.188s
Versus the over 80 seconds spent in various filebucket operations.
Changes:
Total: 1
Events:
Success: 1
Total: 1
Resources:
Changed: 1
Out of sync: 1
Skipped: 6
Total: 8
Time:
Filebucket: 0.00
Config retrieval: 0.14
Last run: 1373376899
File: 86.95
Total: 87.09
Version:
Config: 1373376811
Puppet: 3.1.1
--
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.