警告:缺少宝石'right_aws'

时间:2013-06-17 00:30:43

标签: ruby virtualbox chef vagrant

 I am working my way through a video tutorial at http://gettingstartedwithdjango.com/en/lessons/introduction-and-launch/

我正在使用win7并使用git-bash作为终端。我安装了最新的virtualbox - 4.2.12和最新的vagrant - 1.22。我安装了厨师11.4.4

在本教程的论坛中,我在https://dl.dropboxusercontent.com/u/1343706/gswd-vagrantfile遇到了修改过的vagrantFile。我用这个替换了原来的流浪文件。

我试图让流浪汉起来并得到:

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 8000 => 8888 (adapter 1)
[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] -- /vagrant
[default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] -- /tmp/vagrant-chef-1/chef-solo-2/cookbooks
[default] Running provisioner: shell...
[default] Running: inline script
stdin: is not a tty
Ign http://security.ubuntu.com precise-security InRelease
Ign http://us.archive.ubuntu.com precise InRelease
Ign http://us.archive.ubuntu.com precise-updates InRelease
Ign http://us.archive.ubuntu.com precise-backports InRelease
Hit http://security.ubuntu.com precise-security Release.gpg
Hit http://us.archive.ubuntu.com precise Release.gpg
Hit http://us.archive.ubuntu.com precise-updates Release.gpg
Hit http://security.ubuntu.com precise-security Release
Hit http://us.archive.ubuntu.com precise-backports Release.gpg
Hit http://us.archive.ubuntu.com precise Release
Hit http://us.archive.ubuntu.com precise-updates Release
Hit http://us.archive.ubuntu.com precise-backports Release
Hit http://security.ubuntu.com precise-security/main Sources
Hit http://security.ubuntu.com precise-security/restricted Sources
Hit http://security.ubuntu.com precise-security/universe Sources
Hit http://security.ubuntu.com precise-security/multiverse Sources
Hit http://security.ubuntu.com precise-security/main amd64 Packages
Hit http://security.ubuntu.com precise-security/restricted amd64 Packages
Hit http://us.archive.ubuntu.com precise/main Sources
Hit http://security.ubuntu.com precise-security/universe amd64 Packages
Hit http://security.ubuntu.com precise-security/multiverse amd64 Packages
Hit http://security.ubuntu.com precise-security/main i386 Packages
Hit http://security.ubuntu.com precise-security/restricted i386 Packages
Hit http://security.ubuntu.com precise-security/universe i386 Packages
Hit http://us.archive.ubuntu.com precise/restricted Sources
Hit http://us.archive.ubuntu.com precise/universe Sources
Hit http://us.archive.ubuntu.com precise/multiverse Sources
Hit http://us.archive.ubuntu.com precise/main amd64 Packages
Hit http://us.archive.ubuntu.com precise/restricted amd64 Packages
Hit http://security.ubuntu.com precise-security/multiverse i386 Packages
Hit http://security.ubuntu.com precise-security/main TranslationIndex
Hit http://security.ubuntu.com precise-security/multiverse TranslationIndex
Hit http://security.ubuntu.com precise-security/restricted TranslationIndex
Hit http://security.ubuntu.com precise-security/universe TranslationIndex
Hit http://us.archive.ubuntu.com precise/universe amd64 Packages
Hit http://us.archive.ubuntu.com precise/multiverse amd64 Packages
Hit http://us.archive.ubuntu.com precise/main i386 Packages
Hit http://us.archive.ubuntu.com precise/restricted i386 Packages
Hit http://us.archive.ubuntu.com precise/universe i386 Packages
Hit http://us.archive.ubuntu.com precise/multiverse i386 Packages
Hit http://us.archive.ubuntu.com precise/main TranslationIndex
Hit http://us.archive.ubuntu.com precise/multiverse TranslationIndex
Hit http://us.archive.ubuntu.com precise/restricted TranslationIndex
Hit http://us.archive.ubuntu.com precise/universe TranslationIndex
Hit http://security.ubuntu.com precise-security/main Translation-en
Hit http://security.ubuntu.com precise-security/multiverse Translation-en
Hit http://security.ubuntu.com precise-security/restricted Translation-en
Hit http://us.archive.ubuntu.com precise-updates/main Sources
Hit http://us.archive.ubuntu.com precise-updates/restricted Sources
Hit http://us.archive.ubuntu.com precise-updates/universe Sources
Hit http://us.archive.ubuntu.com precise-updates/multiverse Sources
Hit http://us.archive.ubuntu.com precise-updates/main amd64 Packages
Hit http://security.ubuntu.com precise-security/universe Translation-en
Hit http://us.archive.ubuntu.com precise-updates/restricted amd64 Packages
Hit http://us.archive.ubuntu.com precise-updates/universe amd64 Packages
Hit http://us.archive.ubuntu.com precise-updates/multiverse amd64 Packages
Hit http://us.archive.ubuntu.com precise-updates/main i386 Packages
Hit http://us.archive.ubuntu.com precise-updates/restricted i386 Packages
Hit http://us.archive.ubuntu.com precise-updates/universe i386 Packages
Hit http://us.archive.ubuntu.com precise-updates/multiverse i386 Packages
Hit http://us.archive.ubuntu.com precise-updates/main TranslationIndex
Hit http://us.archive.ubuntu.com precise-updates/multiverse TranslationIndex
Hit http://us.archive.ubuntu.com precise-updates/restricted TranslationIndex
Hit http://us.archive.ubuntu.com precise-updates/universe TranslationIndex
Hit http://us.archive.ubuntu.com precise-backports/main Sources
Hit http://us.archive.ubuntu.com precise-backports/restricted Sources
Hit http://us.archive.ubuntu.com precise-backports/universe Sources
Hit http://us.archive.ubuntu.com precise-backports/multiverse Sources
Hit http://us.archive.ubuntu.com precise-backports/main amd64 Packages
Hit http://us.archive.ubuntu.com precise-backports/restricted amd64 Packages
Hit http://us.archive.ubuntu.com precise-backports/universe amd64 Packages
Hit http://us.archive.ubuntu.com precise-backports/multiverse amd64 Packages
Hit http://us.archive.ubuntu.com precise-backports/main i386 Packages
Hit http://us.archive.ubuntu.com precise-backports/restricted i386 Packages
Hit http://us.archive.ubuntu.com precise-backports/universe i386 Packages
Hit http://us.archive.ubuntu.com precise-backports/multiverse i386 Packages
Hit http://us.archive.ubuntu.com precise-backports/main TranslationIndex
Hit http://us.archive.ubuntu.com precise-backports/multiverse TranslationIndex
Hit http://us.archive.ubuntu.com precise-backports/restricted TranslationIndex
Hit http://us.archive.ubuntu.com precise-backports/universe TranslationIndex
Hit http://us.archive.ubuntu.com precise/main Translation-en
Hit http://us.archive.ubuntu.com precise/multiverse Translation-en
Hit http://us.archive.ubuntu.com precise/restricted Translation-en
Hit http://us.archive.ubuntu.com precise/universe Translation-en
Hit http://us.archive.ubuntu.com precise-updates/main Translation-en
Hit http://us.archive.ubuntu.com precise-updates/multiverse Translation-en
Hit http://us.archive.ubuntu.com precise-updates/restricted Translation-en
Hit http://us.archive.ubuntu.com precise-updates/universe Translation-en
Hit http://us.archive.ubuntu.com precise-backports/main Translation-en
Hit http://us.archive.ubuntu.com precise-backports/multiverse Translation-en
Hit http://us.archive.ubuntu.com precise-backports/restricted Translation-en
Hit http://us.archive.ubuntu.com precise-backports/universe Translation-en
Reading package lists...    

[default] Running provisioner: shell...
[default] Running: inline script
stdin: is not a tty
Reading package lists...    

Building dependency tree...    

Reading state information...    

build-essential is already the newest version.
ruby1.9.3 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 131 not upgraded.
[default] Running provisioner: shell...
[default] Running: inline script
stdin: is not a tty
Successfully installed chef-11.4.4
1 gem installed
[default] Running provisioner: chef_solo...
Generating chef JSON and uploading...
Running chef-solo...
stdin: is not a tty
[2013-06-16T21:02:21+00:00] INFO: *** Chef 11.4.4 ***
[2013-06-16T21:02:22+00:00] INFO: Setting the run_list to ["recipe[postgresql::s
erver_debian]", "recipe[postgresql::ruby]", "recipe[redis::server]", "recipe[git
]", "recipe[mercurial]", "recipe[emacs]", "recipe[vim]", "recipe[nano]", "recipe
[gswd::database]"] from JSON
[2013-06-16T21:02:22+00:00] INFO: Run List is [recipe[postgresql::server_debian]
, recipe[postgresql::ruby], recipe[redis::server], recipe[git], recipe[mercurial
], recipe[emacs], recipe[vim], recipe[nano], recipe[gswd::database]]
[2013-06-16T21:02:22+00:00] INFO: Run List expands to [postgresql::server_debian
, postgresql::ruby, redis::server, git, mercurial, emacs, vim, nano, gswd::datab
ase]
[2013-06-16T21:02:22+00:00] INFO: Starting Chef Run for precise64
[2013-06-16T21:02:22+00:00] INFO: Running start handlers
[2013-06-16T21:02:22+00:00] INFO: Start handlers complete.
[2013-06-16T21:02:24+00:00] WARN: Missing gem 'right_aws'
←[0m
================================================================================
←[0m
←[31mRecipe Compile Error in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/yum/resou
rces/key.rb←[0m
================================================================================
←[0m    

←[0m
ArgumentError←[0m
-------------←[0m
wrong number of arguments (2 for 1)←[0m    

←[0m
Cookbook Trace:←[0m
---------------←[0m
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/resource/lwrp_base.rb:42:in
 `const_defined?'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/resource/lwrp_base.rb:42:in
 `build_from_file'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compil
er.rb:208:in `load_lwrp_resource'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compil
er.rb:193:in `load_lwrps_from_cookbook'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compil
er.rb:192:in `each'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compil
er.rb:192:in `load_lwrps_from_cookbook'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compil
er.rb:120:in `compile_lwrps'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compil
er.rb:119:in `each'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compil
er.rb:119:in `compile_lwrps'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compil
er.rb:72:in `compile'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context.rb:86:in `load'    

  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb:224:in `setup_run
_context'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb:467:in `do_run'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb:200:in `run'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/application.rb:190:in `run_
chef_client'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/application/solo.rb:239:in
`run_application'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/application/solo.rb:231:in
`loop'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/application/solo.rb:231:in
`run_application'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/application.rb:73:in `run'
  /var/lib/gems/1.8/gems/chef-11.4.4/bin/chef-solo:25
  /usr/local/bin/chef-solo:19:in `load'
  /usr/local/bin/chef-solo:19←[0m    

←[0m
Relevant File Content:←[0m
----------------------←[0m
/var/lib/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 c
lass.
 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 t
o
 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 init
ialized -- overriding!")
 48:          end
 49:
 50:          resource_class = Class.new(self)
 51:
←[0m    

←[0m
[2013-06-16T21:02:25+00:00] ERROR: Running exception handlers
[2013-06-16T21:02:25+00:00] ERROR: Exception handlers complete
[2013-06-16T21:02:25+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef
-stacktrace.out
[2013-06-16T21:02:25+00:00] FATAL: ArgumentError: wrong number of arguments (2 f
or 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

有人可以告诉我接下来要做什么来解决这个问题吗?

2 个答案:

答案 0 :(得分:1)

在这种情况下,关于遗失的宝石的警告是无关紧要的 - 实际问题在日志中较低:

 42>>         if Resource.const_defined?(class_name, false)
...
[2013-06-16T21:02:25+00:00] FATAL: ArgumentError: wrong number of arguments (2 for 1)

比较Ruby 1.81.9文档,我们可以看到1.9中的Module#const_defined?方法添加了一个附加参数。

看来您的Chef安装使用的是Ruby 1.8或更低版本,因此出现错误。

确保Chef在现代版本的Ruby上运行的最简单方法是使用omnibus安装程序 - vagrant-omnibus plugin看起来可能会解决您的问题。

答案 1 :(得分:0)

问题是vagrant虚拟映像安装了ruby 1.8版本。 (通过运行vagrant ssh检查它; ruby​​ -v)。您需要将其更新为1.9.x,因为Resource.const_defined函数的参数数量已更改。

以下行动对我有用:

sudo apt-get clean 
sudo apt-get update #this will clean and update the ap-get repositories

sudo apt-get install ruby1.9.3 # installs ruby (you can change the version as you see fit)

然后添加:

config.vm.provision :shell, :inline => "sudo aptitude -y install build-essential"

自动升级Chef后

这将安装将安装make的build-essential软件包。