"没有要加载的文件 - chef / provider / lwrp_base"当尝试使用chef-solo provisioner通过Vagrant运行mysql cookbook时

时间:2014-05-07 17:32:27

标签: vagrant chef-solo

好吧所以我在这里使用了一堆对我来说不熟悉的技术,所以我不确定如何解决这个问题。我对流浪汉有一点经验,现在我正在努力学习厨师。

我已将此食谱克隆:https://github.com/opscode-cookbooks/mysql到我的./cookbooks/mysql目录。我试图通过Vagrant用这个Vagrantfile运行那本食谱:

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

# Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
Vagrant::Config.run do |config|

    config.vm.box = "precise64"
    config.vm.box_url = "http://files.vagrantup.com/precise64.box"


    config.vm.define "mysql" do |mysql|

        mysql.vm.network :hostonly, "192.168.33.12"

        mysql.vm.provision :chef_solo do |chef|
            chef.cookbooks_path = "cookbooks"
            chef.add_recipe "mysql"

            chef.json = {
                :server => {
                    version: '5.6',
                    port: '3307',
                    data_dar: '/data-mysql',
                    allow_remote_root: true,
                    remove_anonymous_Users: true,
                    remove_test_database: true
                }
            }
        end
    end
end

当我跑步时,迷失了mysql'我得到了这个输出:

Running chef-solo...
stdin: is not a tty
[2014-05-07T17:20:23+00:00] INFO: *** Chef 10.14.2 ***
[2014-05-07T17:20:23+00:00] INFO: Run List is []
[2014-05-07T17:20:23+00:00] INFO: Run List expands to []
[2014-05-07T17:20:23+00:00] INFO: Starting Chef Run for precise64
[2014-05-07T17:20:23+00:00] INFO: Running start handlers
[2014-05-07T17:20:23+00:00] INFO: Start handlers complete.

================================================================================
Recipe Compile Error in /tmp/vagrant-chef-2/chef-solo-1/cookbooks/mysql/libraries/provider_mysql_service_omnios.rb
================================================================================

LoadError
---------
no such file to load -- chef/provider/lwrp_base

Cookbook Trace:
---------------
  /tmp/vagrant-chef-2/chef-solo-1/cookbooks/mysql/libraries/provider_mysql_service_omnios.rb:1

为什么会失败?我想知道mysql cookbook是否依赖于另一本应提供' chef / provider / lwrp_base'文件。

更新:问题可能是Vagrant正在运行Chef 10.14.2,而且这本食谱被标记为要求Chef 11(http://community.opscode.com/cookbooks/mysql)。

有很多文件引用LWRP,如下所示:

> gci .\cookbooks * -rec | select-string lwrp

cookbooks\mysql\CHANGELOG.md:320:- [COOK-684] remove mysql_database LWRP
cookbooks\mysql\libraries\provider_mysql_client.rb:5:    class MysqlClient < Chef::Provider::LWRPBase
cookbooks\mysql\libraries\provider_mysql_client_debian.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\provider_mysql_client_fedora.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\provider_mysql_client_omnios.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\provider_mysql_client_rhel.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\provider_mysql_client_smartos.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\provider_mysql_client_ubuntu.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\provider_mysql_service.rb:5:    class MysqlService < Chef::Provider::LWRPBase
cookbooks\mysql\libraries\provider_mysql_service_debian.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\provider_mysql_service_fedora.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\provider_mysql_service_omnios.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\provider_mysql_service_rhel.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\provider_mysql_service_smartos.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\provider_mysql_service_ubuntu.rb:1:require 'chef/provider/lwrp_base'
cookbooks\mysql\libraries\resource_mysql_client.rb:1:require 'chef/resource/lwrp_base'
cookbooks\mysql\libraries\resource_mysql_client.rb:5:    class MysqlClient < Chef::Resource::LWRPBase
cookbooks\mysql\libraries\resource_mysql_service.rb:1:require 'chef/resource/lwrp_base'

3 个答案:

答案 0 :(得分:4)

您可以使用vagrant omnibus plugin

解决此问题

只需运行'vagrant plugin install vagrant-omnibus'即可添加它,并将'config.omnibus.chef_version =:latest'添加到vagrantfile的顶部,就像这样

Vagrant.configure("2") do |config|

  config.omnibus.chef_version = :latest

  ...

end

答案 1 :(得分:0)

在您的食谱上方的目录中,这可能显示了什么 引用lwrp:

查找cookbooks -exec grep lwrp {} \; -print

答案 2 :(得分:0)

好的,问题是我的流浪盒装有旧版本的Ruby和Chef。这一切现在都有效,来源是https://github.com/fschwiet/helloVagrant/tree/ceafdc9916e788136ae79f20722e77d76e2f1eef