On Mar 14, 2012, at 5:20 PM, Peter Bukowinski wrote:

> On Mar 14, 2012, at 5:00 PM, Eugene Vilensky wrote:
> 
>>>> On Monday, March 12, 2012 5:52:53 PM UTC-5, ed209 wrote:
>>>>> 
>>>>> Checkout the 'creates' property, it seems like a cleaner way of doing
>>>>> this:
>>>>> 
>>>>> http://docs.puppetlabs.com/references/2.6.8/type.html#exec
>>>> 
>>>> 
>>>> Pardon the newbie question, but does work on or de-reference symlinks?
>>>> 
>> 
>> On Tue, Mar 13, 2012 at 3:51 PM, Mohamed Lrhazi <lrh...@gmail.com> wrote:
>>> You might want to rephrase your question, as it is not obvious, at
>>> least not to me.
>>> 
>>> Mohamed.
>> 
>> If the "creates" property of a Exec points to a symlink, what is the
>> effect if the target of the symlink is missing?
> 
> 
> The exec will not run in this case. The 'creates' attribute looks for 
> something to exist at the specified path. A symlink, even if broken, is still 
> a file.
> 
> These hypotheticals are simple to test out on your own. To test this case on 
> any puppet client, first create a class:
> 
> #test.pp:
> class test {
>     exec { 'touch /opt/test.did.run': creates => '/opt/test.link' }
> }
> 
> Then create a symlink to a non-existent file:
> 
>     ln -s /opt/nada /opt/test.link
> 
> Finally:
> 
>     puppet apply test.pp
> 
> /opt/test.did.run won't be created.

Apologies, I was completely wrong. Must be something amiss with the above 
manifest. Even when the target is missing it wasn't running the exec. The 
following code will run the exec if the target is a broken symlink but will not 
run it if the target it a valid symlink:

puppet apply -e 'exec { "/bin/touch /opt/exec.did.run": creates => 
"/opt/test.link" }'

So, again, my former conclusion was incorrect. 'creates' appears to be smart 
enough to recognize a broken symlink as a missing file.

-- 
Peter M. Bukowinski
Sr. Systems Engineer
Janelia Farm Research Campus, HHMI

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to