问题
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'
回答1:
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
回答2:
Quick amendment to Thomas Obermüller's response to Draco Ater's answer above. In Vagrant 1.5.1 through Vagrant 1.6.5 (and possibly earlier than 1.5.1; I didn't try it), there are a couple of changes:
chef.encrypted_data_bag_secret
is deprecated, and setting it has no effect.- Vagrant puts the encrypted key at
/tmp/vagrant-chef-2/encrypted_data_bag_secret_key
, instead of defaulting to/etc/chef/encrypted_data_bag_secret
as it did initially.
来源:https://stackoverflow.com/questions/14880503/chef-on-vagrant-box-cant-find-encrypted-data-bag-secret