Issue #1915 has been updated by Teyo Tyree.
Keywords set to Problem #85
I have a workaround, but it's horrible.
SETUP:
# ln -s foo bar
run puppet on the following test.pp:
$filename = "/Users/jbarratt/bar"
file { "$filename":
ensure => file,
links => manage,
replace => true,
content => "well, crap.",
force => true,
}
And you fail on the error:
debug: //File[/Users/jbarratt/bar]/checksum: Initializing checksum hash
debug: //File[/Users/jbarratt/bar]/checksum: Not checksumming symlink
err: //File[/Users/jbarratt/bar]: Failed to retrieve current state of resource:
Could not read /Users/jbarratt/bar: No such file or directory -
/Users/jbarratt/bar
debug: Finishing transaction 16030800 with 0 changes
The workaround is to add an extra exec { }:
$filename = "/Users/jbarratt/bar"
exec { "uglyhack$filename":
command => "/bin/rm -f $filename",
onlyif => "/bin/test -L $filename",
}
file { "$filename":
ensure => file,
links => manage,
replace => true,
content => "well, crap.",
force => true,
require => Exec["uglyhack$filename"],
}
Which works, but is horrible and hackish.
debug: //File[/Users/jbarratt/bar]/require: requires
Exec[uglyhack/Users/jbarratt/bar]
debug: //Exec[uglyhack/Users/jbarratt/bar]: Skipping automatic relationship
with File[/Users/jbarratt/bar]
debug: //Exec[uglyhack/Users/jbarratt/bar]: Executing check '/bin/test -L
/Users/jbarratt/bar'
debug: Executing '/bin/test -L /Users/jbarratt/bar'
debug: //Exec[uglyhack/Users/jbarratt/bar]: Changing returns
debug: //Exec[uglyhack/Users/jbarratt/bar]: 1 change(s)
debug: //Exec[uglyhack/Users/jbarratt/bar]: Executing '/bin/rm -f
/Users/jbarratt/bar'
debug: Executing '/bin/rm -f /Users/jbarratt/bar'
notice: //Exec[uglyhack/Users/jbarratt/bar]/returns: executed successfully
debug: //File[/Users/jbarratt/bar]: File does not exist
debug: //File[/Users/jbarratt/bar]: Changing ensure
debug: //File[/Users/jbarratt/bar]: 1 change(s)
debug: //File[/Users/jbarratt/bar]/checksum: Initializing checksum hash
debug: //File[/Users/jbarratt/bar]: Creating checksum
{md5}b670e3a1c7408e76521f9a4edeaa822a
notice: //File[/Users/jbarratt/bar]/ensure: content changed
'{md5}b670e3a1c7408e76521f9a4edeaa822a' to '{md5}b670e3a1c7408e76521f9a4edeaa82
If puppet is managing a canonical resource on a filesystem, it should be able
to specify and modify any attribute of that resource.
Ideally,
file { "/path/name":
content => "...",
ensure => file,
}
should be all I need to do. Puppet's job would be to transform my system to
match the way the resources are modeling it's reality.
----------------------------------------
Bug #1915: File resources fail when original is a dangling symlink
http://projects.reductivelabs.com/issues/1915
Author: micah -
Status: Accepted
Priority: Normal
Assigned to:
Category: file
Target version:
Affected version: 0.24.7
Keywords: Problem #85
Branch:
If before puppet has run, my host has the following dangling symlink:
<pre>
$ ls -l /etc/motd
lrwxrwxrwx 1 root root 13 2006-09-26 23:46 /etc/motd -> /var/run/motd
$ ls -ld /var/run/motd
ls: cannot access /var/run/motd: No such file or directory
</pre>
Then I define a file resource for this host as follows:
<pre>
file{"/etc/motd":
content => ("foo"),
owner => root, group => 0, mode => 0644;
}
</pre>
Puppet then files to create that file, due to the dangling symlink:
<pre>
err: //motd::client/File[/etc/motd]: Failed to retrieve current state of
resource: Could not read /etc/motd: No such file or directory - /etc/motd
</pre>
I've tried various parameters to the file resource to override this such as
backup => false, link => ignore, force => true and they all fail.
It seems like puppet should just remove the dangling symlink and replace it
with what should be there, rather than error when the current state of the
resource is in error.
--
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
-~----------~----~----~----~------~----~------~--~---