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

僤鯓⒐⒋嵵緔 提交于 2019-11-30 12:40:38

问题


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:

  1. chef.encrypted_data_bag_secret is deprecated, and setting it has no effect.
  2. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!