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.
Yes, this is to be expected. See the Chef wiki for further details:
http://wiki.opscode.com/display/chef/Anatomy+of+a+Chef+Run
Excerpt:
-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:
http://wiki.opscode.com/display/chef/Resources#Resources-RubyBlock
-Tim
Tim Green
Field Solutions Architect | Opscode, Inc.
Direct: 718-517-7969
Cell: 860-287-4653
Twitter - @tim_ops
On Wednesday, August 8, 2012 at 10:59 AM, vin4gud@gmail.com 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.