読者です 読者をやめる 読者になる 読者になる

knife solo init で`select_or_disable_by_chef_config!': undefined method `select!'

knife solo initで以下のエラーが出力された。

$ nife solo init chef-repo -VV  

Creating kitchen...
Creating knife.rb in kitchen...
Creating cupboards...
DEBUG: Selecting cookbook manager...
/Library/Ruby/Gems/1.8/gems/knife-solo-0.3.0/lib/knife-solo/cookbook_manager_selector.rb:41:in `select_or_disable_by_chef_config!': undefined method `select!' for # (NoMethodError)
    from /Library/Ruby/Gems/1.8/gems/knife-solo-0.3.0/lib/knife-solo/cookbook_manager_selector.rb:16:in `select'
    from /Library/Ruby/Gems/1.8/gems/knife-solo-0.3.0/lib/chef/knife/solo_init.rb:80:in `cookbook_manager'
    from /Library/Ruby/Gems/1.8/gems/knife-solo-0.3.0/lib/chef/knife/solo_init.rb:37:in `run'
    from /Library/Ruby/Gems/1.8/gems/chef-11.6.0/lib/chef/knife.rb:466:in `run_with_pretty_exceptions'
    from /Library/Ruby/Gems/1.8/gems/chef-11.6.0/lib/chef/knife.rb:173:in `run'
    from /Library/Ruby/Gems/1.8/gems/chef-11.6.0/lib/chef/application/knife.rb:123:in `run'
    from /Library/Ruby/Gems/1.8/gems/chef-11.6.0/bin/knife:25
    from /usr/bin/knife:19:in `load'
    from /usr/bin/knife:19

Rubyのselect!メソッドは1.9.2からなので、大人しくRubyをバージョンアップする。

rbenvをつかっている場合、rehashをすることを忘れない。