chef-infratest-kitchenchef-zero

how to get information about chef provisioner (chef-zero or not) inside a chef recipe?


In my recipe I want to find out the the mode in which chef is running and load from data bag based on that. If it is running chef-zero then I will load the data bag in a specific way and if not in a different way .

if Chef::Config[:zero] == 'true'
  //Load unencryted databag from local
else
 //Load encrypted databag
end

But currently it always enters the else block. I am running kitchen with

provisioner:
  name: chef_zero

Solution

  • Answering my own question - The solution i was looking for is using kitchen attributes.

    https://stackoverflow.com/a/38429417/888070