0

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
StephenKing
  • 36,187
  • 11
  • 83
  • 112
Shamik
  • 1,591
  • 2
  • 16
  • 36

2 Answers2

0

If you use the data_bag_item() helper it will handle this for you internally. It is better to avoid explicit branching whenever possible.

coderanger
  • 52,400
  • 4
  • 52
  • 75
0

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

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

Community
  • 1
  • 1
Shamik
  • 1,591
  • 2
  • 16
  • 36