Issue #14531 has been updated by Stefan Schulte.

I guess the intended behaviour is that puppet will only check the correct link 
target if the link does already exist (because you omitted the ensure 
property). To make sure that a certain link exists *and* does point to a 
certain target you have to write
<pre>
file { '/mnt/tmp/test':
  ensure => link,
  target => '/mnt/tmp/x',
}
</pre>
see http://docs.puppetlabs.com/guides/style_guide.html#symbolic-links

As it turns out puppet *really* freaks out when specifying `target` without 
`ensure` because it may silently remove stuff when I expect puppet to do nothing
<pre>
# ls -ld /lib 
lrwxrwxrwx 1 root root 5 21. Sep 2011  /lib -> lib64
# puppet apply -ve 'file { "/lib": target => "lib64"}'
notice: /Stage[main]//File[/lib]/ensure: ensure changed 'link' to 'symlink'
# ls -ld /lib                                         
ls: cannot access /lib: No such file or directory
</pre>
----------------------------------------
Bug #14531: Puppet doesn't create symlinks when just using 'target => 
/path/to/file'
https://projects.puppetlabs.com/issues/14531#change-63348

Author: Jos Boumans
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.6.16
Keywords: 
Branch: 


Consider the following code:


    
    $ ls -al /mnt/tmp/{x,test}
    ls: cannot access /mnt/tmp/test: No such file or directory
    -rw-r--r-- 1 jib users 3 May  4 23:35 /mnt/tmp/x
    $ cat z.pp
    file { '/mnt/tmp/test':
    target => '/mnt/tmp/x',
    }
    $ sudo puppet apply z.pp
    notice: /Stage[main]//File[/mnt/tmp/test]/ensure: created
    notice: Finished catalog run in 3.56 seconds
    $ ls -al /mnt/tmp/{x,test}
    ls: cannot access /mnt/tmp/test: No such file or directory
    -rw-r--r-- 1 jib users 3 May  4 23:35 /mnt/tmp/x
    
Changing 'target' to 'ensure' works around the issue.


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