Re: [Puppet Users] Re: Use onlyif in EXEC

Peter Bukowinski
Thu, 15 Mar 2012 13:18:33 -0000

On Mar 15, 2012, at 8:54 AM, jcbollinger wrote:

>
>
> On Mar 14, 4:40 pm, Peter Bukowinski <pmb...@gmail.com> wrote:
>> On Mar 14, 2012, at 5:20 PM, Peter Bukowinski wrote:
>>> On Mar 14, 2012, at 5:00 PM, Eugene Vilensky wrote:
>>
>>>> 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.
>
>
> I don''t call that "smart", I call it "buggy".
The target of a symlink
> is not the symlink itself.  Even a broken symlink named in an
Exec''s
> ''creates'' should be sufficient to prevent that Exec from
running.  At
> best, the documentation is inadequate.  I encourage you to file an
> issue report.
>
>
> John


Submitted.

http://projects.puppetlabs.com/issues/13126

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