gpt4 book ai didi

vagrant - "no such file to load -- chef/provider/lwrp_base"尝试使用 Chef-solo 配置程序通过 Vagrant 运行 mysql Recipe 时

转载 作者:行者123 更新时间:2023-12-02 17:32:39 25 4
gpt4 key购买 nike

好吧,我在这里使用了一些对我来说很新的技术,所以我不知道如何解决这个问题。我对 vagrant 有一点经验,现在正在尝试学习 Chef。

我克隆了这本 Recipe :https://github.com/opscode-cookbooks/mysql到我的 ./cookbooks/mysql 目录。我正在尝试使用以下 Vagrantfile 通过 Vagrant 运行该 Recipe :

# 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

当我运行“vagrant up 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 Recipe 是否依赖于另一本应提供“chef/provider/lwrp_base”文件的 Recipe 。

更新:问题可能是 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'

最佳答案

您可以使用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

关于vagrant - "no such file to load -- chef/provider/lwrp_base"尝试使用 Chef-solo 配置程序通过 Vagrant 运行 mysql Recipe 时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23524425/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com