Order of Execution of resources in a cookbook


#1

Hi Folks,

I have a cookbook (to be run on a windows node) that has multiple “script” and
"powershell_script" resources defined in the order I want them to be executed.
I am logging to a text file within each resource. The log shows that the
resources are not being executed in the order they are written in the cookbook?
Is it an expected behavior? If so, is there a way to force them to run in a
particular order?

Thanks

-Kapil


#2

That behavior is not expected.

Can you run chef-client with -VV and share the chef-client log output as
well as your log? It would be ideal if your log had time stamps. Also,
what version of chef-client are you running?

Certainly you could use notifications to force an ordering (e.g. set all
but first to action :nothing and then have each script resource subscript
to its intended predecessor), but you shouldn’t have to do that – order
of definition in the cookbook is a defined total order of execution.

-Adam
-----Original Message-----
From: kapil.shardha@ems-works.com [mailto:kapil.shardha@ems-works.com]
Sent: Monday, February 10, 2014 8:42 AM
To: chef@lists.opscode.com
Subject: [chef] Order of Execution of resources in a cookbook

Hi Folks,

I have a cookbook (to be run on a windows node) that has multiple
"script" and “powershell_script” resources defined in the order I want
them to be executed.
I am logging to a text file within each resource. The log shows that the
resources are not being executed in the order they are written in the
cookbook?
Is it an expected behavior? If so, is there a way to force them to run in
a particular order?

Thanks

-Kapil