无法使用厨师食谱在流浪盒上安装mysql-client

时间:2014-11-20 06:22:40

标签: mysql ruby vagrant chef chef-recipe

我一直在尝试使用this厨师食谱安装厨师 - 客户。当包含配方mysql :: client时,它会尝试安装mysql gem客户端。抛出很多错误,我无法调试问题。我google了很多,但没有出现。请让我知道解决方案,如果需要我将发布整个堆栈跟踪,但它太长了。

此外,如果我删除了食谱的mysql :: client配方,它将安装mysql :: server,也会安装失败的客户端。当我明确包含mysql :: client时,它会出于某种原因尝试安装mysql-client gem。

这是错误日志

Error executing action `install` on resource 'chef_gem[mysql]'
==> default: ================================================================================
==> default: 
==> default: 
==> default: 
==> default: Gem::Installer::ExtensionBuildError
==> default: 
==> default: -----------------------------------
==> default: ERROR: Failed to build gem native extension.
==> default: 
==> default:         /opt/chef/embedded/bin/ruby extconf.rb
==> default: checking for mysql_query() in -lmysqlclient... no
==> default: checking for main() in -lm... yes
==> default: checking for mysql_query() in -lmysqlclient... no
==> default: checking for main() in -lz... yes
==> default: checking for mysql_query() in -lmysqlclient... no
==> default: checking for main() in -lsocket... no
==> default: checking for mysql_query() in -lmysqlclient... no
==> default: checking for main() in -lnsl... yes
==> default: checking for mysql_query() in -lmysqlclient... no
==> default: checking for main() in -lmygcc... no
==> default: checking for mysql_query() in -lmysqlclient... no
==> default: *** extconf.rb failed ***
==> default: Could not create Makefile due to some reason, probably lack of
==> default: necessary libraries and/or headers.  Check the mkmf.log file for more
==> default: details.  You may need configuration options.
==> default: 
==> default: Provided configuration options:
==> default:    --with-opt-dir
==> default:    --with-opt-include
==> default:    --without-opt-include=${opt-dir}/include
==> default:    --with-opt-lib
==> default:    --without-opt-lib=${opt-dir}/lib
==> default:    --with-make-prog
==> default:    --without-make-prog
==> default:    --srcdir=.
==> default:    --curdir
==> default:    --ruby=/opt/chef/embedded/bin/ruby
==> default:    --with-mysql-config
==> default:    --without-mysql-config
==> default:    --with-mysql-dir
==> default:    --without-mysql-dir
==> default:    --with-mysql-include
==> default:    --without-mysql-include=${mysql-dir}/include
==> default:    --with-mysql-lib
==> default:    --without-mysql-lib=${mysql-dir}/lib
==> default:    --with-mysqlclientlib
==> default:    --without-mysqlclientlib
==> default:    --with-mlib
==> default:    --without-mlib
==> default:    --with-mysqlclientlib
==> default:    --without-mysqlclientlib
==> default:    --with-zlib
==> default:    --without-zlib
==> default:    --with-mysqlclientlib
==> default:    --without-mysqlclientlib
==> default:    --with-socketlib
==> default:    --without-socketlib
==> default:    --with-mysqlclientlib
==> default:    --without-mysqlclientlib
==> default:    --with-nsllib
==> default:    --without-nsllib
==> default:    --with-mysqlclientlib
==> default:    --without-mysqlclientlib
==> default:    --with-mygcclib
==> default:    --without-mygcclib
==> default:    --with-mysqlclientlib
==> default:    --without-mysqlclientlib
==> default: 
==> default: 
==> default: Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mysql-2.9.1 for inspection.
==> default: Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
==> default: 
==> default: 
==> default: 
==> default: Cookbook Trace:
==> default: ---------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql-chef_gem/libraries/provider_mysql_chef_gem.rb:20:in `block in action_install'
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql-chef_gem/libraries/provider_mysql_chef_gem.rb:11:in `action_install'
==> default: 
==> default: 
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql-chef_gem/libraries/provider_mysql_chef_gem.rb
==> default: 
==> default:  20:           chef_gem 'mysql' do
==> default:  21:             action :install
==> default:  22:           end
==> default:  23:         end
==> default: 
==> default: 
==> default: 
==> default: Compiled Resource:
==> default: ------------------
==> default: # Declared in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql-chef_gem/libraries/provider_mysql_chef_gem.rb:20:in `block in action_install'
==> default: 
==> default: chef_gem("mysql") do
==> default:   provider Chef::Provider::Package::Rubygems
==> default:   action [:install]
==> default:   retries 0
==> default:   retry_delay 2
==> default:   guard_interpreter :default
==> default:   package_name "mysql"
==> default:   version "2.9.1"
==> default:   cookbook_name :"mysql-chef_gem"
==> default: end
==> default: 
==> default: 
==> default: 

1 个答案:

答案 0 :(得分:1)

尝试将mysql cookbook更新到更新版本。 安装rubygem已经被移到自己的食谱中,现在在mysql-chef_gem cookbook中完成。

管理食谱或应用程序的Cookbook依赖关系的最佳方法是使用berkshelf。使用berkshelf,您可以轻松地按项目供应烹饪书,然后使用这些供应商版本来配置您的机器。

如果您通过git直接提取食谱而不是超市,可以指定版本或sha。