2014-01-16 38 views
1

以下Getting Started Writing Chef Cookbooks the Berkshelf Way教程從misheska blog。但具體在Part 2 Mysql and Create database廚師錯誤安裝mysql使用'database :: mysql'配方

當我執行

$ vagrant up 

$ vagrant provision 

我得到在控制檯輸出以下錯誤:

Bringing machine 'default' up with 'virtualbox' provider... 
[default] Importing base box 'opscode-ubuntu-12.04'... 
[default] Matching MAC address for NAT networking... 
[default] Setting the name of the VM... 
[default] Clearing any previously set forwarded ports... 
[Berkshelf] This version of the Berkshelf plugin has not been fully tested on this version of Vagrant. 
[Berkshelf] You should check for a newer version of vagrant-berkshelf. 
[Berkshelf] If you encounter any errors with this version, please report them at https://github.com/RiotGames/vagrant-berkshelf/issues 
[Berkshelf] You can also join the discussion in #berkshelf on Freenode. 
[Berkshelf] Updating Vagrant's berkshelf: '/home/montells/.berkshelf/default/vagrant/berkshelf-20140117-2071-x216zp-default' 
[Berkshelf] Using myface (0.1.0) 
[Berkshelf] Using mysql (4.0.18) 
[Berkshelf] Using openssl (1.1.0) 
[Berkshelf] Using build-essential (1.4.2) 
[Berkshelf] Using apache2 (1.8.14) 
[Berkshelf] Using database (1.6.0) 
[Berkshelf] Using postgresql (3.3.4) 
[Berkshelf] Using apt (2.3.4) 
[Berkshelf] Using aws (1.0.0) 
[Berkshelf] Using xfs (1.1.0) 
[default] Creating shared folders metadata... 
[default] Clearing any previously set network interfaces... 
[default] Preparing network interfaces based on configuration... 
[default] Forwarding ports... 
[default] -- 22 => 2222 (adapter 1) 
[default] Booting VM... 
[default] Waiting for machine to boot. This may take a few minutes... 
[default] Machine booted and ready! 
[default] Setting hostname... 
[default] Configuring and enabling network interfaces... 
[default] Mounting shared folders... 
[default] -- /vagrant 
[default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks 
[default] Running provisioner: chef_solo... 
Generating chef JSON and uploading... 
Running chef-solo... 
stdin: is not a tty 
[2014-01-17T14:42:52+00:00] INFO: Forking chef instance to converge... 
[2014-01-17T14:42:52+00:00] INFO: *** Chef 11.8.2 *** 
[2014-01-17T14:42:52+00:00] INFO: Chef-client pid: 1327 
[2014-01-17T14:42:55+00:00] INFO: Setting the run_list to ["recipe[myface::default]"] from JSON 
[2014-01-17T14:42:55+00:00] INFO: Run List is [recipe[myface::default]] 
[2014-01-17T14:42:55+00:00] INFO: Run List expands to [myface::default] 
[2014-01-17T14:42:55+00:00] INFO: Starting Chef Run for ubuntu 
[2014-01-17T14:42:55+00:00] INFO: Running start handlers 
[2014-01-17T14:42:55+00:00] INFO: Start handlers complete. 
[2014-01-17T14:42:56+00:00] WARN: Cloning resource attributes for directory[/var/lib/mysql] from prior resource (CHEF-3694) 
[2014-01-17T14:42:56+00:00] WARN: Previous directory[/var/lib/mysql]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/_server_debian.rb:34:in `block in from_file' 
[2014-01-17T14:42:56+00:00] WARN: Current directory[/var/lib/mysql]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/_server_debian.rb:70:in `from_file' 
[2014-01-17T14:43:06+00:00] INFO: execute[apt-get-update-build-essentials] ran successfully 
[2014-01-17T14:45:33+00:00] WARN: failed to find gem mysql (>= 0) from [http://rubygems.org/] 
[2014-01-17T14:45:33+00:00] ERROR: Running exception handlers 
[2014-01-17T14:45:33+00:00] ERROR: Exception handlers complete 
[2014-01-17T14:45:33+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out 
[2014-01-17T14:45:33+00:00] ERROR: chef_gem[mysql] (mysql::ruby line 47) had an error: ArgumentError: Illformed requirement [""] 

================================================================================ 
Error executing action `install` on resource 'chef_gem[mysql]' 
================================================================================ 


ArgumentError 
------------- 
Illformed requirement [""] 


Cookbook Trace: 
--------------- 
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/ruby.rb:47:in `from_file' 
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/database/recipes/mysql.rb:20:in `from_file' 
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/myface/recipes/database.rb:11:in `from_file' 
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/myface/recipes/default.rb:10:in `from_file' 


Resource Declaration: 
--------------------- 
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/ruby.rb 

47: chef_gem 'mysql' 



Compiled Resource: 
------------------ 
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/ruby.rb:47:in `from_file' 

chef_gem("mysql") do 
    provider Chef::Provider::Package::Rubygems 
    action :install 
    retries 0 
    retry_delay 2 
    package_name "mysql" 
    cookbook_name :mysql 
    recipe_name "ruby" 
end 




================================================================================ 
Recipe Compile Error in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/myface/recipes/default.rb 
================================================================================ 


ArgumentError 
------------- 
chef_gem[mysql] (mysql::ruby line 47) had an error: ArgumentError: Illformed requirement [""] 


Cookbook Trace: 
--------------- 
    /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/ruby.rb:47:in `from_file' 
    /tmp/vagrant-chef-1/chef-solo-1/cookbooks/database/recipes/mysql.rb:20:in `from_file' 
    /tmp/vagrant-chef-1/chef-solo-1/cookbooks/myface/recipes/database.rb:11:in `from_file' 
    /tmp/vagrant-chef-1/chef-solo-1/cookbooks/myface/recipes/default.rb:10:in `from_file' 


Relevant File Content: 
---------------------- 
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/ruby.rb: 

40: end 
41: end 
42: 
43: node['mysql']['client']['packages'].each do |name| 
44: resources("package[#{name}]").run_action(:install) 
45: end 
46: 
47>> chef_gem 'mysql' 
48: 


[2014-01-17T14:42:52+00:00] INFO: Forking chef instance to converge... 
[2014-01-17T14:45:33+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. 

這是我myface /屬性/ default.rb

default['myface']['user'] = 'myface' 
default['myface']['group'] = 'myface' 
default['myface']['name'] = 'myface' 
default['myface']['config'] = 'myface.conf' 
default['myface']['document_root'] = '/srv/apache/myface' 

#**************** Database attr ********************************************* 
default['myface']['database']['host'] = 'localhost' 
default['myface']['database']['username'] = 'root' 
default['myface']['database']['password'] = node['mysql']['server_root_password'] 
default['myface']['database']['dbname'] = 'myface' 

myface /食譜/ database.rb

include_recipe 'mysql::server' 
include_recipe 'database::mysql' 

mysql_database node['myface']['database']['dbname'] do 
    connection(
    :host => node['myface']['database']['host'], 
    :username => node['myface']['database']['username'], 
    :password => node['myface']['database']['password'] 
) 
    action :create 
end 

myface /食譜/ default.rb

include_recipe 'myface::database' 
include_recipe 'myface::webserver' 

有人知道發生什麼事? 注意:第1部分Install Apache2正常工作。 有趣的細節:我用我自己的本地寶石服務器geminabox 我可以給更多的細節,如果有人有想法。

回答

1

讀取調試輸出,您的gem服務器不包含MySQL gem。