Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Deployment Vagrant、Chef和veewee box的设置错误_Deployment_Rubygems_Chef Infra_Vagrant - Fatal编程技术网

Deployment Vagrant、Chef和veewee box的设置错误

Deployment Vagrant、Chef和veewee box的设置错误,deployment,rubygems,chef-infra,vagrant,Deployment,Rubygems,Chef Infra,Vagrant,我正试图用PHP构建一个Ubuntu 12.04.2 amd64精确框。 环顾四周,我找到了这个我想用作存储库的存储库,尝试一下,一切都很好,但我需要用64位的存储库来更改基本存储库 因此,我使用以下方法创建了一个新框: 克隆源存储库: git clone --recursive git://github.com/simshaun/symfony-vagrant.git cd symfony-vagrant/vagrant 为了使用我的新框,我更改了Vagrantfile中的行: config

我正试图用PHP构建一个Ubuntu 12.04.2 amd64精确框。 环顾四周,我找到了这个我想用作存储库的存储库,尝试一下,一切都很好,但我需要用64位的存储库来更改基本存储库

因此,我使用以下方法创建了一个新框:

克隆源存储库:

git clone --recursive git://github.com/simshaun/symfony-vagrant.git
cd symfony-vagrant/vagrant
为了使用我的新框,我更改了
Vagrantfile
中的行:

config.vm.box = "web-php54-precise"
config.vm.box_url = ""
但是运行
vagrant up
时,我在chef solo部署期间遇到了一个致命错误。 我试图在
include\u recipe
中更改
require\u recipe
,但没有成功。我认为供应器无法识别文件
networking\u basic/attributes/default.rb
,因此
node['networking']['packages']
结果未定义

请注意,将相同的配方直接添加到Vagrantfile中效果良好:

config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = "cookbooks"
    # chef.add_recipe "networking_basic" <= this works
    chef.add_recipe "vagrant_main"
    # cut #
end

您的假设是正确的,节点['networking']为零,因此它不能有['packages']子属性

潜在的问题是,vagrant_主菜谱正在执行“include_recipe”,但定义了节点['networking']['packages']的networking_基本菜谱的属性文件尚未加载

在Chef版本10和更早版本中,Chef没有。一般的假设是运行列表顺序,因为这是加载配方的顺序。因此,Chef现在从第11版开始这样做

但是,在本例中,运行列表没有网络基础烹饪书,vagrant主目录包括它。为了确保加载组件,需要依赖于我们正在使用的烹饪书。要解决此问题,请创建包含以下内容的vagrant_main/metadata.rb文件:

name "vagrant_main"
depends "apache2"
depends "apt"
depends "mysql"
depends "networking_basic"
depends "php"
depends "xdebug"

回答得很好。在搜索了几个小时后,这确实奏效了。
  vagrant git:(master) ✗ vagrant up
[default] Importing base box 'web-php54-precise'...
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 80 => 8080 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Available bridged network interfaces:
1) en0: Ethernet
2) en1: Wi-Fi (AirPort)
3) p2p0
What interface should the network bridge to? 1
[default] Preparing network interfaces based on configuration...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] -- project1: /home/vagrant/web-app
[default] -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] Running provisioner: Vagrant::Provisioners::ChefSolo...
[default] Generating chef JSON and uploading...
[default] Running chef-solo...
stdin: is not a tty
[2013-02-22T13:10:02+00:00] INFO: *** Chef 11.4.0 ***
[2013-02-22T13:10:03+00:00] INFO: Setting the run_list to ["recipe[vagrant_main]"] from JSON
[2013-02-22T13:10:03+00:00] INFO: Run List is [recipe[vagrant_main]]
[2013-02-22T13:10:03+00:00] INFO: Run List expands to [vagrant_main]
[2013-02-22T13:10:03+00:00] INFO: Starting Chef Run for web-php54-precise
[2013-02-22T13:10:03+00:00] INFO: Running start handlers
[2013-02-22T13:10:03+00:00] INFO: Start handlers complete.
[2013-02-22T13:10:03+00:00] WARN: require_recipe is deprecated and will be removed in a future release, please use include_recipe
[2013-02-22T13:10:03+00:00] WARN: require_recipe is deprecated and will be removed in a future release, please use include_recipe


================================================================================

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

================================================================================




NoMethodError

-------------

undefined method `[]' for nil:NilClass




Cookbook Trace:
---------------
  /tmp/vagrant-chef-1/chef-solo-1/cookbooks/networking_basic/recipes/default.rb:7:in `from_file'
  /tmp/vagrant-chef-1/chef-solo-1/cookbooks/vagrant_main/recipes/default.rb:10:in `from_file'


Relevant File Content:
----------------------
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/networking_basic/recipes/default.rb:

  1:  #
  2:  # Cookbook Name:: networking_basic
  3:  # Recipe:: default
  4:  #
  5:  #
  6:
  7>> node['networking']['packages'].each do |netpkg|
  8:    package netpkg
  9:  end
 10:


[2013-02-22T13:10:03+00:00] ERROR: Running exception handlers
[2013-02-22T13:10:03+00:00] ERROR: Exception handlers complete
[2013-02-22T13:10:03+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-02-22T13:10:03+00:00] FATAL: NoMethodError: undefined method `[]' for nil:NilClass
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
name "vagrant_main"
depends "apache2"
depends "apt"
depends "mysql"
depends "networking_basic"
depends "php"
depends "xdebug"