0

我实际上是想通过使用 Altoros cf-vagrant-installer 进程来设置 Cloudfoundry V2 实例:

https://github.com/Altoros/cf-vagrant-installer

一切正常,我在 ubuntu 12.10 服务器上安装了一个安装了 berkshelf 插件的 vagrant 1.2.2,virtualbox 4.1.18。

我已经完成了第一步,即克隆 git repo,通过 vagrant up 安装盒子,ssh 它,启动结束 ssh 会话的 postinstall 脚本。

所以我再次流浪并得到这个:

ringing machine 'cf-install' up with 'virtualbox' provider...
[cf-install] Setting the name of the VM...
[cf-install] 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/oadmin/.berkshelf/cf-
install/vagrant/berkshelf-20130703-21144-1ni4f5h-cf-install'
[Berkshelf] Using apt (1.10.0)
[Berkshelf] Using git (2.5.2)
[Berkshelf] Using sqlite (1.0.0)
[Berkshelf] Using mysql (3.0.2)
[Berkshelf] Using postgresql (3.0.2)
[Berkshelf] Using chef-golang (1.0.1)
[Berkshelf] Using java (1.11.6)
[Berkshelf] Using ruby_build (0.8.0)
[Berkshelf] Installing rbenv (0.7.3) from git: 'git://github.com/fnichol/chef-rbenv.git' 
with branch: 'master' at ref: 'e10f98d5fd07bdb8d212ebf42160b65c39036b90'
[Berkshelf] Using rbenv-alias (0.0.0) at './chef/rbenv-alias'
[Berkshelf] Using rbenv-sudo (0.0.1) at './chef/rbenv-sudo'
[Berkshelf] Using cloudfoundry (0.0.0) at './chef/cloudfoundry'
[Berkshelf] Using dmg (1.1.0)
[Berkshelf] Using build-essential (1.4.0)
[Berkshelf] Using yum (2.3.0)
[Berkshelf] Using windows (1.10.0)
[Berkshelf] Using chef_handler (1.1.4)
[Berkshelf] Using runit (1.1.6)
[Berkshelf] Using openssl (1.0.2)
[cf-install] Creating shared folders metadata...
[cf-install] Clearing any previously set network interfaces...
[cf-install] Preparing network interfaces based on configuration...
[cf-install] Forwarding ports...
[cf-install] -- 22 => 2222 (adapter 1)
[cf-install] -- 80 => 8080 (adapter 1)
[cf-install] Running any VM customizations...
[cf-install] Booting VM...
[cf-install] Waiting for VM to boot. This can take a few minutes.
[cf-install] VM booted and ready for use!
[cf-install] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
cause things such as shared folders to not work properly. If you see
shared folder errors, please update the guest additions within the
virtual machine and reload your VM.

Guest Additions Version: 4.2.0
VirtualBox Version: 4.1
[cf-install] Configuring and enabling network interfaces...
[cf-install] Mounting shared folders...
[cf-install] -- /vagrant
[cf-install] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[cf-install] Running provisioner: chef_solo...
Generating chef JSON and uploading..

结果是这样:

Running chef-solo...
stdin: is not a tty
[2013-07-03T15:10:41+00:00] INFO: *** Chef 11.4.4 ***
[2013-07-03T15:10:43+00:00] INFO: Setting the run_list to ["recipe[apt::default]",     
"recipe[git]", "recipe[chef-golang]", "recipe[ruby_build]", "recipe[rbenv::user]",   
"recipe[java::openjdk]", "recipe[sqlite]",    
"recipe[mysql::server]","recipe[postgresql::server]", "recipe[rbenv-alias]",   
 "recipe[rbenv-sudo]", "recipe[cloudfoundry::warden]", "recipe[cloudfoundry::dea]", 
 "recipe[cloudfoundry::uaa]", "recipe[cloudfoundry::cf_bootstrap]"] from JSON
[2013-07-03T15:10:43+00:00] INFO: Run List is [recipe[apt::default], recipe[git],   
recipe[chef-golang], recipe[ruby_build], recipe[rbenv::user], recipe[java::openjdk], 
recipe[sqlite], recipe[mysql::server], recipe[postgresql::server], recipe[rbenv-alias], 
recipe[rbenv-sudo], recipe[cloudfoundry::warden], recipe[cloudfoundry::dea],    
recipe[cloudfoundry::uaa], recipe[cloudfoundry::cf_bootstrap]]
[2013-07-03T15:10:43+00:00] INFO: Run List expands to [apt::default, git, chef-golang,    
ruby_build, rbenv::user, java::openjdk, sqlite, mysql::server, postgresql::server,   
rbenv-alias, rbenv-sudo, cloudfoundry::warden, cloudfoundry::dea, cloudfoundry::uaa, 
cloudfoundry::cf_bootstrap]
[2013-07-03T15:10:43+00:00] INFO: Starting Chef Run for precise64
[2013-07-03T15:10:43+00:00] INFO: Running start handlers
[2013-07-03T15:10:43+00:00] INFO: Start handlers complete.

================================================================================
Recipe Compile Error in /tmp/vagrant-chef-1/chef-solo-   
1/cookbooks/apt/resources/preference.rb

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

ArgumentError
-------------
wrong number of arguments (2 for 1)

Cookbook Trace:
---------------
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-  
11.4.4/bin/../lib/chef/resource/lwrp_base.rb:42:in `const_defined?'
  /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-  
11.4.4/bin/../lib/chef/resource/lwrp_base.rb:42:in `build_from_file' 
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef- 
11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:208:in `load_lwrp_resource'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-
11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:193:in 
`load_lwrps_from_cookbook'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-   
11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:192:in `each'
  /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-  
11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:192:in   
`load_lwrps_from_cookbook'
  /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-
 11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:120:in `compile_lwrps'
  /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-  
11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:119:in `each'
  /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-  
11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:119:in `compile_lwrps'
  /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-
11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:72:in `compile'
  /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-
11.4.4/bin/../lib/chef/run_context.rb:86:in `load'
  /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb:224:in 
`setup_run_context'
  /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb:467:in   
`do_run'
 /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb:200:in  
`run'
  /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-
 11.4.4/bin/../lib/chef/application.rb:190:in `run_chef_client'

 /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-
11.4.4/bin/../lib/chef/application/solo.rb:239:in `run_application'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-   
11.4.4/bin/../lib/chef/application/solo.rb:231:in `loop'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-
11.4.4/bin/../lib/chef/application/solo.rb:231:in `run_application'

/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-
11.4.4/bin/../lib/chef/application.rb:73:in `run'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/chef-solo:25
/opt/vagrant_ruby/bin/chef-solo:19:in `load'
 /opt/vagrant_ruby/bin/chef-solo:19


Relevant File Content:
----------------------
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-  
11.4.4/bin/../lib/chef/resource/lwrp_base.rb:

 35:  
 36:        # Evaluates the LWRP resource file and instantiates a new Resource class.
 37:        def self.build_from_file(cookbook_name, filename, run_context)
 38:          rname = filename_to_qualified_string(cookbook_name, filename)
 39:  
 40:          # Add log entry if we override an existing light-weight resource.
 41:          class_name = convert_to_class_name(rname)
 42>>         if Resource.const_defined?(class_name, false)
 43:            old_class = Resource.send(:remove_const, class_name)
 44:            # CHEF-3432 -- Chef::Resource keeps a list of subclasses; need to
 45:            # remove old ones from the list when replacing.
 46:            resource_classes.delete(old_class)
 47:            Chef::Log.info("#{class_name} light-weight resource already initialized    
-- overriding!")
 48:          end
 49:  
 50:          resource_class = Class.new(self)
 51:  

[2013-07-03T15:10:44+00:00] ERROR: Running exception handlers
[2013-07-03T15:10:44+00:00] ERROR: Exception handlers complete
[2013-07-03T15:10:44+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef -  
stacktrace.out
[2013-07-03T15:10:44+00:00] FATAL: ArgumentError: wrong number of arguments (2 for 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

任何帮助/想法将不胜感激

4

4 回答 4

2

这是带有 Ruby 1.8 的 Chef 10.24.4 和 11.4.4 中的一个错误:CHEF-4123。修复已提交但尚未发布。

您需要降级 Chef 版本,等待新版本或升级 Ruby。安装 Chef 的推荐方法是使用具有嵌入式 Ruby的“综合安装程序”。Vagrant 有一个出色的vagrant-omnibus插件。

于 2013-07-04T13:22:47.300 回答
0

I'd like to add something in tmatilai's answer. I tackled the same issue once. Only option seemed to be upgrading ruby to 1.9.3 and upgrading chef to 11.4.4 after upgrading ruby.

So I added following line before provisioning chef-solo.

config.vm.provision :shell, :path => "somescript.sh"

then I added a somescript.sh file parallel to cookbooks directory in the chef kitchen, which contained

apt-get update
apt-get -y install ruby1.9.3 build-essential
gem install chef --version 11.4.4 --no-rdoc --no-ri --conservative

everything ran fine after that.

于 2013-07-16T12:59:57.987 回答
0

您是否更新了 cf-vagrant-installer 的副本?我很确定这个 Chef 错误是几周前在那里解决的。

于 2013-07-08T12:41:02.820 回答
0

现在一切都很好(这个问题很好..)使用最新的 cf-vagrant-installer 代码。

感谢大家 !!

于 2013-07-09T08:32:59.623 回答