Recipes execution order


I have a recipe like this, using Chef 12.21:

include_recipe 'websphere-mq::91'


execute "Configuring Queue Manager objects, queues, channels, listerners, etc." do
 environment ({ 'HOME' => ::Dir.home('mqm'), 'USER' => 'mqm' })
 command "su - mqm -c 'runmqsc < /opt/mqm/saveqm/file.mqsc > /opt/mqm/saveqm/file.log'; echo \"OK\""

When I run, the recipe broke with this:

  user mqm doesn't exist

Yea, this user does not exist yes, it supposed to be created in the very first include.
How can I fix this? :slight_smile:


you'd need to delay evaluation of the environment with lazy {} as described here: . ::Dir.home is calculated based on the state at the beginning of the run, unless you delay it.