我正在尝试使用Vagrant
设置Chef Solo
框。但是当我尝试使用lxmx_oh_my_zsh::data_bag
食谱时,我收到了下面描述的错误。
这是我的Vargantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Use Ubuntu 14.04 Trusty Tahr 64-bit as our operating system
config.vm.box = "ubuntu/trusty64"
# Configurate the virtual machine to use 2GB of RAM
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
# Forward the Rails server default port to the host
# config.vm.network :forwarded_port, guest: 3000, host: 3000
config.librarian_chef.cheffile_dir = "olympus-kitchen"
# Use Chef Solo to provision our virtual machine
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["olympus-kitchen/cookbooks", "olympus-kitchen/site-cookbooks"]
chef.add_recipe "chef-solo-search"
chef.add_recipe "apt"
chef.add_recipe "hostname"
chef.add_recipe "lxmx_oh_my_zsh::data_bag"
chef.json = {
set_fqdn: 'Olympus',
users: ['vagrant']
}
end
end
这是我的Cheffile
site "http://community.opscode.com/api/v1"
cookbook 'chef-solo-search'
cookbook 'apt'
cookbook 'build-essential'
cookbook 'hostname'
cookbook 'lxmx_oh_my_zsh'
我vagrant provision
==> default: Installing Chef cookbooks with Librarian-Chef...
==> default: Running provisioner: chef_solo...
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2014-08-09T15:04:32+00:00] INFO: Forking chef instance to converge...
==> default: [2014-08-09T15:04:32+00:00] INFO: *** Chef 11.8.2 ***
==> default: [2014-08-09T15:04:32+00:00] INFO: Chef-client pid: 10999
==> default: [2014-08-09T15:04:33+00:00] INFO: Setting the run_list to ["recipe[chef-solo-search]", "recipe[apt]", "recipe[hostname]", "recipe[lxmx_oh_my_zsh::data_bag]"] from JSON
==> default: [2014-08-09T15:04:33+00:00] INFO: Run List is [recipe[chef-solo-search], recipe[apt], recipe[hostname], recipe[lxmx_oh_my_zsh::data_bag]]
==> default: [2014-08-09T15:04:33+00:00] INFO: Run List expands to [chef-solo-search, apt, hostname, lxmx_oh_my_zsh::data_bag]
==> default: [2014-08-09T15:04:33+00:00] INFO: Starting Chef Run for Olympus
==> default: [2014-08-09T15:04:33+00:00] INFO: Running start handlers
==> default: [2014-08-09T15:04:33+00:00] INFO: Start handlers complete.
==> default: [2014-08-09T15:04:33+00:00] WARN: Cloning resource attributes for execute[apt-get-update] from prior resource (CHEF-3694)
==> default: [2014-08-09T15:04:33+00:00] WARN: Previous execute[apt-get-update]: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/apt/recipes/default.rb:29:in `from_file'
==> default: [2014-08-09T15:04:33+00:00] WARN: Current execute[apt-get-update]: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/apt/recipes/default.rb:38:in `from_file'
==> default: [2014-08-09T15:04:33+00:00] ERROR: Failed to load data bag item: "users" "vagrant"
==> default: [2014-08-09T15:04:34+00:00] ERROR: Running exception handlers
==> default: [2014-08-09T15:04:34+00:00] ERROR: Exception handlers complete
==> default: [2014-08-09T15:04:34+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2014-08-09T15:04:34+00:00] ERROR: can't convert Array into String
==> default:
==> default: ================================================================================
==> default: Recipe Compile Error in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/lxmx_oh_my_zsh/recipes/data_bag.rb
==> default: ================================================================================
==> default:
==> default:
==> default: TypeError
==> default: ---------
==> default: can't convert Array into String
==> default:
==> default:
==> default: Cookbook Trace:
==> default: ---------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/lxmx_oh_my_zsh/recipes/data_bag.rb:4:in `block in from_file'
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/lxmx_oh_my_zsh/recipes/data_bag.rb:3:in `each'
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/lxmx_oh_my_zsh/recipes/data_bag.rb:3:in `from_file'
==> default:
==> default:
==> default: Relevant File Content:
==> default: ----------------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/lxmx_oh_my_zsh/recipes/data_bag.rb:
==> default:
==> default: 1: include_recipe 'lxmx_oh_my_zsh'
==> default: 2:
==> default: 3: node['users'].each do |name|
==> default: 4>> user = data_bag_item('users', name)
==> default: 5:
==> default: 6: if user['oh-my-zsh'] && user['oh-my-zsh']['enabled']
==> default: 7:
==> default: 8: if res_action = user['oh-my-zsh']['action']
==> default: 9: res_action = res.action.to_sym
==> default: 10: end
==> default: 11:
==> default: 12: lxmx_oh_my_zsh_user user['id'] do
==> default: 13: home user['home']
==> default:
==> default:
==> default:
==> default: [2014-08-09T15:04:32+00:00] INFO: Forking chef instance to converge...
==> default: [2014-08-09T15:04:34+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the output above. Please fix your recipes so that they properly complete.