I am trying to perform a stray installation and would like to have 1.9.3-p327 as the standard ruby version. I use a chef and a librarian chef to control a vagrant machine.
my pre-backup file for the chef is as follows
config.vm.provision :chef_solo do |chef| chef.cookbooks_path = "cookbooks" chef.add_recipe "apt" chef.add_recipe "build-essential" chef.add_recipe "git" chef.add_recipe "ruby_build" chef.add_recipe "rbenv::system" chef.add_recipe "rbenv::vagrant" chef.add_recipe "sqlite" chef.add_recipe "nodejs" chef.add_recipe "mysql" chef.add_recipe "redisio" chef.add_recipe "redisio::install" chef.add_recipe "redisio::redis_gem" chef.add_recipe "zlib" chef.add_recipe "wkhtmltopdf" chef.json = { "rbenv" => { "rubies" => [ "1.9.3-p327" ], "global" => "1.9.3-p327", "gems" => { "1.9.3-p327" => [ { "name" => "bundler" } ] } } } end
and the sheffil who is looking for the librarian cheff looks like this:
site 'http://community.opscode.com/api/v1' cookbook 'apt' cookbook 'git' cookbook 'build-essential' cookbook 'rbenv', git: 'https://github.com/fnichol/chef-rbenv.git' cookbook 'ruby_build' cookbook 'sqlite', git: 'git://github.com/opscode-cookbooks/sqlite.git' cookbook 'nodejs', git: 'http://github.com/mdxp/nodejs-cookbook' cookbook 'mysql', git: 'git://github.com/opscode-cookbooks/mysql.git' cookbook 'redisio', git: 'git://github.com/brianbianco/redisio.git' cookbook 'zlib', git: 'git://github.com/opscode-cookbooks/zlib' cookbook 'wkhtmltopdf', git: 'git://github.com/firstbanco/chef-wkhtmltopdf.git'
and of these two, I should be able to run a stray file, unfortunately, it looks as if I indicate that the ruby version for chef-solo is exploding. he worked yesterday afternoon, which makes me think that someone updated the cookbook between now and now. therefore, when I called the library chef, he pulled it and got scared.
================================================================================ Error executing action `install` on resource 'rbenv_ruby[1.9.3-p327] (system)' ================================================================================ NoMethodError ------------- undefined method `loaded_recipe?' for #<Chef::RunContext:0x7f34cf773ed0> Cookbook Trace: --------------- /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/providers/ruby.rb:88:in `ruby_build_missing?' /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/providers/ruby.rb:43:in `perform_install' /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/providers/ruby.rb:33:in `class_from_file' Resource Declaration: --------------------- # In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/recipes/system.rb 27: else 28: rbenv_ruby rubie 29: end Compiled Resource: ------------------ # Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/recipes/system.rb:28:in `from_file' rbenv_ruby("1.9.3-p327") do retry_delay 2 retries 0 recipe_name "system" definition "1.9.3-p327" action :install cookbook_name :rbenv end [2013-05-31T09:55:55+00:00] ERROR: Running exception handlers [2013-05-31T09:55:55+00:00] ERROR: Exception handlers complete [2013-05-31T09:55:55+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out [2013-05-31T09:55:55+00:00] FATAL: NoMethodError: rbenv_ruby[1.9.3-p327] (system) (rbenv::system line 28) had an error: NoMethodError: undefined method `loaded_recipe?' for #<Chef::RunContext:0x7f34cf773ed0> Chef never successfully completed! Any errors should be visible in the output above. Please fix your recipes so that they properly complete.
if I comment on json which indicates the ruby version, then it works. it seems that you need to specify rbenv versions, but what reliable versions are and where can I find them.
Edit: You will also need to provide user data in json. as you install on system and user (roaming) levels. and the chef uses ruby, which provides a stray box. this is what my updated ruby version for rbenv json looks like.
chef.json = { 'rbenv' => { 'user_installs' => [ { 'user' => 'vagrant', 'rubies' => ['1.9.3-p327'], 'global' => '1.9.3-p327', 'gems' => { '1.9.3-p327' => [ { 'name' => 'bundler' }, { 'name' => 'rake' } ] } } ] },