Skip to content

Instantly share code, notes, and snippets.

@thecatwasnot
Created October 5, 2011 16:47
Show Gist options
  • Save thecatwasnot/564d59022cf4347fb85b to your computer and use it in GitHub Desktop.
Save thecatwasnot/564d59022cf4347fb85b to your computer and use it in GitHub Desktop.
chef-rvm & vagrant fail :(
Generated at Wed Oct 05 09:43:53 -0700 2011
NoMethodError: undefined method `keys' for []:Array
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/node/attribute.rb:250:in `keys'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/node/attribute.rb:248:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/node/attribute.rb:248:in `keys'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/node/attribute.rb:243:in `get_keys'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/node/attribute.rb:129:in `each'
/tmp/vagrant-chef-1/chef-solo-2/rvm/recipes/user_install.rb:24:in `to_a'
/tmp/vagrant-chef-1/chef-solo-2/rvm/recipes/user_install.rb:24:in `Array'
/tmp/vagrant-chef-1/chef-solo-2/rvm/recipes/user_install.rb:24:in `from_file'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/cookbook_version.rb:578:in `load_recipe'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:40:in `include_recipe'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe'
/tmp/vagrant-chef-1/chef-solo-2/rvm/recipes/user.rb:20:in `from_file'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/cookbook_version.rb:578:in `load_recipe'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:40:in `include_recipe'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:72:in `load'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:69:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:69:in `load'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/client.rb:195:in `setup_run_context'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/client.rb:159:in `run'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:192:in `run_application'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:183:in `loop'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:183:in `run_application'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application.rb:66:in `run'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/chef-solo:25
/opt/ruby/bin/chef-solo:19:in `load'
/opt/ruby/bin/chef-solo:19
Vagrant::Config.run do |config|
# Basic vagrant config stuff...
config.vm.share_folder "shared", "/shared", "shared"
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["chef/opscode/cookbooks", "chef/fnichol/cookbooks"]
chef.add_recipe "rvm::default"
chef.add_recipe "rvm::user"
chef.add_recipe "rvm::vagrant"
chef.add_recipe "rvm::user_install"
chef.run_list = [
"recipe[rvm::user]",
"recipe[rvm::vagrant]"
]
#
# # You may also specify custom JSON attributes:
chef.json = {
:rvm => {
:user_installs => {
:vagrant => {
:version => '1.8.5',
:default_ruby => 'ruby-1.9.3',
:rubies => ['1.9.2'],
:rvmrc => {
:rvm_project_rvmrc => 1,
:rvm_gemset_create_on_use_flag => 1,
:rvm_pretty_print_flag => 1
},
:global_gems => [
{ :name => 'bundler',
:version => '1.0.18'
}
]
}
}
}
}
end
end
@fnichol
Copy link

fnichol commented Oct 5, 2011

I think this is due to a documentation/usage error in the README around user based installs. Try this out:

    chef.json = { 
      :rvm => {
        :user_installs => [
          { :user => 'vagrant',
            :version => '1.8.5',
            :default_ruby => 'ruby-1.9.3',
            :rubies => ['1.9.2'],
            :rvmrc => {
              :rvm_project_rvmrc             => 1,
              :rvm_gemset_create_on_use_flag => 1,
              :rvm_pretty_print_flag         => 1
            },
            :global_gems => [
              { :name => 'bundler',
                :version => '1.0.18'
              }
            ]
          }
        ]
      }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment