Yes, this is to be expected. See the Chef wiki for further details:
-Plain Ruby code outside of resources is evaluated, however.
-If you would like Ruby code executed with other resources, use a Ruby Block Resource.
For further details on postponing execution of arbitrary Ruby code until convergence, see here:
Field Solutions Architect | Opscode, Inc.
Twitter - @tim_ops
On Wednesday, August 8, 2012 at 10:59 AM, firstname.lastname@example.org wrote:
I have a custom library in a cookbook. It is included in several recipes and
the library function is invoked several times. It appears that all the function
calls are processed during the compile phase of the chef run. Is this expected?
I want it to be invoked during the execution phase. Is this possible?
Note: The library function posts messages to a queue using stomp.