0
 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ファイルをこれに置き換えました。

vagrant up を実行しようとしたところ、次のようになりました。

$ 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.

誰かがこれを修正するために次に何をすべきか教えてもらえますか?

4

2 に答える 2

1

この場合、gem が見つからないという警告は関係ありません。実際の問題は、ログの下部にあります。

 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.9Module#const_defined?のドキュメントを比較すると、1.9 ではメソッドに追加のパラメーターが追加されていることがわかります。

Chef インストールが Ruby 1.8 以下を使用しているように見えるため、エラーが発生します。

最新バージョンの Ruby で Chef が実行されていることを確認する最も簡単な方法は、オムニバス インストーラーを使用することです。

于 2013-06-18T13:32:11.877 に答える
0

問題は、vagrant 仮想イメージに ruby​​ 1.8 バージョンがインストールされていることです。(vagrant ssh; ruby​​ -v を実行して確認してください)。Resource.const_defined 関数のパラメータ数が変更されたため、1.9.x にアップデートする必要があります。

次のアクションは私にとってはうまくいきました:

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 パッケージがインストールされます。

于 2013-07-08T21:02:51.447 に答える