Using the following commands I am able to get chef-shell to execute, pulling in all of my cookbooks and data bags:
kitchen login
cd /tmp/kitchen
sudo -E /opt/chef/embedded/bin/chef-zero -d
sudo knife cookbook upload -a -c client.rb
sudo knife upload data_bags -c client.rb
sudo -E /opt/chef/bin/chef-shell -z -c client.rb -j dna.json -o "role-web-server::default"
However, I get the following exception:
Chef::Exceptions::InvalidDataBagItemID
--------------------------------------
Data Bag items must have an id matching /^[\.\-[:alnum:]_]+$/, you gave: nil
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/chef-vault/libraries/chef_vault_item.rb:44:in `chef_vault_item'
... other stacktrace...
The value nil is provided to the chef_vault_item function, when I have an appropriate value specified in my .kitchen.yml, and it's in the dna.json that I passed in to chef-shell. I know the value is there because my regular 'kitchen converge' finds the attribute just fine.
Why are the node attributes in the Test Kitchen generated dna.json not being included in my chef-shell execution? Am I going about it all wrong to get chef-shell to run inside of a Test Kitchen VM?
The
-zoption for chef-shell doesn't automatically involve the chef zero/local-mode systems. It predates those by a bunch,-zis the short form of--clientwhich just uses the config in theclient.rb. You would need to modify that to point at Chef Zero.Are you sure you mean to be using
chef-shell? It sounds more like you mean to usechef-clientthere.