Re: [Puppet Users] Use onlyif in EXEC

Peter Bukowinski
Wed, 14 Mar 2012 21:20:08 -0000

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 <lrhazi@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.

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