Issue #1915 has been updated by Miguel Filho.

I was reading the Learning Guide and the page 
http://docs.puppetlabs.com/learning/manifests.html suggests changing the login 
message by setting the content of /etc/motd. This is how I bumped into the same 
problem.

<pre>
root@puppetmaster:/etc# ls -l /etc/motd
lrwxrwxrwx 1 root root 13 Jan  8 20:01 /etc/motd -> /var/run/motd
root@puppetmaster:/etc# cat /etc/motd
cat: /etc/motd: No such file or directory
</pre>

<pre>
file { "motd":
        path    => "/etc/motd",
        ensure  => present,
        content => "Message of the day!\n",
}
</pre>

* Running the code above, Puppet returns success but nothing happens. The 
target /var/run/motd is not created.
* Using 'links => follow' Puppet overwrites the symlink and create a regular 
file at /etc/motd. This is not the documented behavior: "... and follow will 
manage the file to which the link points." from 
http://docs.puppetlabs.com/references/stable/type.html
* Using 'links => manage' nothing happens.

Another point is that the documentation about 'links' is inconsistent. It says:
<pre>
How to handle links during file actions. During file copying, follow will copy 
the target 
file instead of the link, manage will copy the link itself, and ignore will 
just pass it by.
When not copying, manage and ignore behave equivalently (because you cannot 
really ignore
links entirely during local recursion), and follow will manage the file to 
which the link
points. Valid values are follow, manage.
</pre>

It mentions 'ignore' but it is not a valid value as mentioned in the last 
phrase.
<pre>
# puppet apply motd.pp 
Parameter links failed: Invalid value "ignore". Valid values are follow, manage.
</pre>

Bottom line is that 'links => follow' is not creating the target file if the 
symlink is dangling and the documentation about 'links' needs some corrections.

I did my tests using version 2.7.6.
----------------------------------------
Bug #1915: File resources fail when original is a dangling symlink
https://projects.puppetlabs.com/issues/1915

Author: micah -
Status: Accepted
Priority: Normal
Assignee: 
Category: file
Target version: 2.7.x
Affected Puppet 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://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