Chef on Vagrant Box: Can't find encrypted data bag secret

j7nn7k picture j7nn7k · Feb 14, 2013 · Viewed 8.1k times · Source

When provisioning a vagrant box with (hosted-)chef I get the following error:

No such file or directory - file not found '/tmp/encrypted_data_bag_secret'

Here is the call causing the error:

ssl = Chef::EncryptedDataBagItem.load("ssl", s[:id])

I also can't find the encrypted_data_bag_secret in /etc/chef where it normally resides on my other servers.

Am I missing a config which uploads the data bag secret?

Here's the rest of the stack trace:

[2013-02-14T16:51:15+00:00] ERROR: Running exception handlers
[2013-02-14T16:51:15+00:00] FATAL: Saving node information to /srv/chef/file_store/failed-run-data.json
[2013-02-14T16:51:15+00:00] ERROR: Exception handlers complete
[2013-02-14T16:51:15+00:00] FATAL: Stacktrace dumped to /srv/chef/file_store/chef-stacktrace.out
[2013-02-14T16:51:15+00:00] FATAL: Errno::ENOENT: No such file or directory - file not found '/tmp/encrypted_data_bag_secret'

Answer

Draco Ater picture Draco Ater · Feb 14, 2013

When provisioning a vagrant box, you have to provide a path to your data bags secret key, if you want to use encrypted data bags.

config.vm.provision :chef_solo do |chef|
  [...]
  chef.encrypted_data_bag_secret_key_path = '/etc/chef/encrypted_data_bag_secret'
  [...]
end