GithubHelp home page GithubHelp logo

sous-chefs / ruby_rbenv Goto Github PK

View Code? Open in Web Editor NEW
332.0 26.0 254.0 811 KB

Development repository for the ruby_rbenv cookbook

Home Page: https://supermarket.chef.io/cookbooks/ruby_rbenv

License: Apache License 2.0

Ruby 98.89% HTML 1.11%
chef-cookbook ruby-rbenv chef-resource chef hacktoberfest managed-by-terraform

ruby_rbenv's Introduction

Chef ruby_rbenv Cookbook

Cookbook Version CI State OpenCollective License

Description

Manages [rbenv][rbenv_site] and its installed Rubies.

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

Chef

This cookbook requires Chef 13.0+.

NOTE: Some Chef versions (>= 16 and < 16.4.41) have a bug in the git resource causing some failures (see #289). If you experience any troubles please try a more recent version of Chef 16.

Platform

  • Debian derivatives
  • Fedora
  • macOS (not currently tested)
  • RHEL derivatives (RHEL, CentOS, Amazon Linux, Oracle, Scientific Linux)
  • openSUSE and openSUSE leap

Resources

Usage

Example installations are provided in test/fixtures/cookbooks/test/recipes/.

A rbenv_system_install or rbenv_user_install is required to be set so that rbenv knows which version you want to use, and is installed on the system.

System wide installations of rbenv are supported by this cookbook, but discouraged by the rbenv maintainer, see [these][rbenv_issue_38] [two][rbenv_issue_306] issues in the rbenv repository.

System-Wide macOS Installation Note

This cookbook takes advantage of managing profile fragments in an /etc/profile.d directory, common on most Unix-flavored platforms. Unfortunately, macOS does not support this idiom out of the box, so you may need to [modify][mac_profile_d] your user profile.

Development

  • Source hosted at [GitHub][repo]
  • Report issues/Questions/Feature requests on [GitHub Issues][issues]

Pull requests are very welcome! Make sure your patches are well tested.

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

http://www.apache.org/licenses/LICENSE-2.0

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

ruby_rbenv's People

Contributors

aried3r avatar axelrtgs avatar chourobin avatar clockwerx avatar damacus avatar fnichol avatar gsandie avatar he9lin avatar ianbrown78 avatar jasherai avatar johnroesler avatar josegonzalez avatar kitchen-porter avatar logankoester avatar mclarke avatar mozgiii avatar msaffitz avatar powerschill avatar ramereth avatar renovate[bot] avatar sds avatar sekrett avatar tas50 avatar tatat avatar thoughtless avatar tmaier avatar veraticus avatar vptheron avatar xorima avatar xorimabot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby_rbenv's Issues

user_installs doesn't seem to work for all users.

We are using chef-rbenv to build a Vagrant box that is used for CI. Our Vagrantfile looks like this:

chef.json = {
  // ...
  :rbenv => {
      :user_installs => [
        { :user => 'jenkins' }
      ]
    },
}

In in our own cookbook we run the jenkins::default recipe, which creates a jenkins user on the system. We then run rbenv::user_install recipe which based on our configuration should install rbenv for the jenkins user.

However, when we vagrant ssh in and then sudo su jenkins, running rbenv results in sh: rbenv: not found.

We originally had two users in our user_installs list, the jenkins user and vagrant user. The vagrant user seemed to have rbenv installed correctly, while the jenkins user did not. We removed the vagrant user to limit moving parts as much as possible, but we've still had no luck.

Any ideas?

system install precludes user space installs

A std user should be able to run chef-solo to install a user space rbenv and ruby. However if there is a system rbenv and ruby install in place, the user space rbenv install script seems to get confused:

[Thu, 09 Feb 2012 18:31:05 +1100] INFO: Processing script[rbenv rehash (system)] action run (/home/hedge/personal-chef/cookbooks/rbenv/providers/script.rb line 28)
[Thu, 09 Feb 2012 18:31:05 +1100] INFO: script[rbenv rehash (system)] sh("bash"  "/tmp/chef-script20120209-10138-shlfut")
[Thu, 09 Feb 2012 18:31:05 +1100] ERROR: script[rbenv rehash (system)] (/home/hedge/personal-chef/cookbooks/rbenv/providers/script.rb line 28) has had an error
[Thu, 09 Feb 2012 18:31:05 +1100] ERROR: script[rbenv rehash (system)] (/home/hedge/personal-chef/cookbooks/rbenv/providers/script.rb:28:in `block in class_from_file') had an error:
script[rbenv rehash (system)] (/home/hedge/personal-chef/cookbooks/rbenv/providers/script.rb line 28) had an error: Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20120209-10138-shlfut" ----
STDOUT: 
STDERR: rbenv: version `global' not installed
rbenv: cannot rehash: /usr/local/rbenv/shims/.rbenv-shim exists
---- End output of "bash"  "/tmp/chef-script20120209-10138-shlfut" ----
Ran "bash"  "/tmp/chef-script20120209-10138-shlfut" returned 1
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/shell_out.rb:206:in `invalid!'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/shell_out.rb:192:in `error!'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/mixin/shell_out.rb:36:in `shell_out!'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/provider/execute.rb:58:in `action_run'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/provider/script.rb:33:in `action_run'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource.rb:440:in `run_action'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:45:in `run_action'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in `block (2 levels) in converge'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in `each'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in `block in converge'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection.rb:94:in `block in execute_each_resource'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection.rb:92:in `execute_each_resource'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:76:in `converge'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:312:in `converge'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:160:in `run'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:192:in `block in run_application'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `loop'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `run_application'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/application.rb:67:in `run'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/bin/chef-solo:25:in `<top (required)>'
/home/hedge/personal-chef/vendor/ruby/1.9.1/bin/chef-solo:19:in `load'
/home/hedge/personal-chef/vendor/ruby/1.9.1/bin/chef-solo:19:in `<main>'
[Thu, 09 Feb 2012 18:31:05 +1100] ERROR: Running exception handlers
[Thu, 09 Feb 2012 18:31:05 +1100] ERROR: Exception handlers complete
[Thu, 09 Feb 2012 18:31:05 +1100] FATAL: Stacktrace dumped to /home/hedge/.chef/state/cache/chef-stacktrace.out
[Thu, 09 Feb 2012 18:31:05 +1100] FATAL: Chef::Exceptions::ShellCommandFailed: script[rbenv rehash (system)] (/home/hedge/personal-chef/cookbooks/rbenv/providers/script.rb line 28) had an error: Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20120209-10138-shlfut" ----
STDOUT: 
STDERR: rbenv: version `global' not installed
rbenv: cannot rehash: /usr/local/rbenv/shims/.rbenv-shim exists
---- End output of "bash"  "/tmp/chef-script20120209-10138-shlfut" ----
Ran "bash"  "/tmp/chef-script20120209-10138-shlfut" returned 1

How to update rubygems under rbenv?

I am trying to figure out how to keep rubygems updated in an manageable way with this cookbook.

I created the following recipe:

node.set["rubygems"]["version"] = "n.n.n"

bash "rubygems-update" do
  code <<-EOF
    gem update --system #{node["rubygems"]["version"]}
  EOF
end

Which works fine, but only updates the "system" ruby.
I guess I could then wrap that in a loop and iterate over the rbenv installed rubies, calling the version-specific gem binary.
But I am just wondering (hoping) if I am just missing something perhaps already built into the cookbook to do this in an easier way?

Error while installing gems

I am using the master branch of rbenv and while installing rbenv based gem from this hash

    "rbenv" => {
        "user_installs" => [
          { "user" => "vagrant",
            "rubies" => [ "1.9.3-p429" ],
            "global" => "1.9.3-p429",
            "gems" => {
              "1.9.3-p429" => [
                { "name" => "bundler" },
                { "name" => "rake" },
                { "name" => "thin" },
                { "name" => "rails" },
                { "name" => "pry-full" }
              ],
            }
          }
        ]
      },

I got the following error and do not have a clue what the problem is:

================================================================================
Error executing action `install` on resource 'rbenv_gem[1.9.3-p429::thin (vagrant)] (vagrant)'
================================================================================


NoMethodError
-------------
undefined method `last' for #<Gem::AvailableSet:0x00000003a5c140>


Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/recipes/user.rb

 53:       rbenv_gem "#{gem['name']} (#{rbenv_user['user']})" do
 54:         package_name    gem['name']
 55:         user            rbenv_user['user']
 56:         root_path       rbenv_user['root_path'] if rbenv_user['root_path']
 57:         rbenv_version   rubie
 58:
 59:         %w{version action options source}.each do |attr|
 60:           send(attr, gem[attr]) if gem[attr]
 61:         end
 62:       end
 63:     end



Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/recipes/user.rb:53:in `block (3 levels) in from_file'

rbenv_gem("thin (vagrant)") do
  provider Chef::Provider::Package::RbenvRubygems
  action :install
  retries 0
  retry_delay 2
  cookbook_name :rbenv
  recipe_name "user"
  package_name "thin"
  user "vagrant"
  rbenv_version "1.9.3-p429"
  gem_binary "export RBENV_ROOT=\"/home/vagrant/.rbenv\" && export PATH=\"$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH\" && export RBENV_VERSION=\"1.9.3-p429\" && $RBENV_ROOT/shims/gem"
end



[2013-06-21T13:09:34+02:00] INFO: Running queued delayed notifications before re-raising exception
[2013-06-21T13:09:34+02:00] ERROR: Running exception handlers
[2013-06-21T13:09:34+02:00] ERROR: Exception handlers complete
[2013-06-21T13:09:34+02:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-06-21T13:09:34+02:00] FATAL: NoMethodError: rbenv_gem[1.9.3-p429::thin (vagrant)] (vagrant) (rbenv::user line 53) had an error: NoMethodError: undefined method `last' for #<Gem::AvailableSet:0x00000003a5c140>
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

When I do the install manually with the same environment variables the gem is installed without problems...

Does anybody know how to fix this?

unable to install 1.9.3-p286 with user recipe on vagrant

I am trying to install a newer version of ruby using this recipe but can not figure out what is not correctly setup. I have the following setup in my Vagrantfile:

config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = "./cookbooks"

    chef.add_recipe "build-essential"
    chef.add_recipe "git"
    chef.add_recipe "ruby_build"
    chef.add_recipe "rbenv::vagrant"
    chef.add_recipe "rbenv::user"

    chef.json = {
      'rbenv' => {
        'user_installs' => [{
          'user' => 'vagrant',
          'rubies' => [ '1.9.3-p286' ],
          'global' => '1.9.3-p286',
          'gems'   => {
            '1.9.3-p286' => [
              { 'name'   => 'bundler' }
            ]
          }
        }]
      }
    }

When doing vagrant up it fails with the following output:

------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/providers/script.rb:28:in `class_from_file'

script("rbenv install 1.9.3-p286 (vagrant)") do
  retry_delay 2
  environment {"RBENV_ROOT"=>"/home/vagrant/.rbenv", "USER"=>"vagrant", "HOME"=>"/home/vagrant"}
  user "vagrant"
  returns [0]
  command "\"bash\"  \"/tmp/chef-script20121113-2372-d1vh3l-0\""
  retries 0
  code "export RBENV_ROOT=\"/home/vagrant/.rbenv\"\nexport PATH=\"${RBENV_ROOT}/bin:$PATH\"\neval \"$(rbenv init -)\"\n\nrbenv shell global\n\nrbenv install 1.9.3-p286\n"
  action "run"
  cookbook_name :rbenv
  interpreter "bash"
  backup 5
end

[2012-11-13T10:28:49+01:00] ERROR: Running exception handlers
[2012-11-13T10:28:49+01:00] ERROR: Exception handlers complete
[2012-11-13T10:28:49+01:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2012-11-13T10:28:49+01:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: script[rbenv install 1.9.3-p286 (vagrant)] (/tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/providers/script.rb line 28) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20121113-2372-d1vh3l-0" ----
STDOUT: 
STDERR: rbenv: version `global' not installed
ruby-build: definition not found: 1.9.3-p286
---- End output of "bash"  "/tmp/chef-script20121113-2372-d1vh3l-0" ----
Ran "bash"  "/tmp/chef-script20121113-2372-d1vh3l-0" returned 1
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

From what I can see here the command issues rbenv shell global do not seem to be correct. Shouldn't it be either rbenv global *version* or rbenv shell *version*? To get further I removed this from script.rb to see if that helps but then it fails on the next command (the install part) with following output instead:

------------------

# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/providers/script.rb:28:in `class_from_file'

script("rbenv install 1.9.3-p286 (vagrant)") do
  retry_delay 2
  environment {"RBENV_ROOT"=>"/home/vagrant/.rbenv", "HOME"=>"/home/vagrant", "USER"=>"vagrant"}
  user "vagrant"
  returns [0]
  command "\"bash\"  \"/tmp/chef-script20121113-2365-16h6kal-0\""
  retries 0
  code "export RBENV_ROOT=\"/home/vagrant/.rbenv\"\nexport PATH=\"${RBENV_ROOT}/po:$PATH\"\neval \"$(rbenv init -)\"\n\nrbenv install 1.9.3-p286\n"
  action "run"
  cookbook_name :rbenv
  interpreter "bash"
  backup 5
end

[2012-11-13T10:46:47+01:00] ERROR: Running exception handlers
[2012-11-13T10:46:47+01:00] ERROR: Exception handlers complete
[2012-11-13T10:46:47+01:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2012-11-13T10:46:47+01:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: script[rbenv install 1.9.3-p286 (vagrant)] (/tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/providers/script.rb line 28) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '127'
---- Begin output of "bash"  "/tmp/chef-script20121113-2365-16h6kal-0" ----
STDOUT: 
STDERR: /tmp/chef-script20121113-2365-16h6kal-0: line 3: rbenv: command not found
/tmp/chef-script20121113-2365-16h6kal-0: line 5: rbenv: command not found
---- End output of "bash"  "/tmp/chef-script20121113-2365-16h6kal-0" ----
Ran "bash"  "/tmp/chef-script20121113-2365-16h6kal-0" returned 127

So, for the chef instance running it do not actually seem to have rbenv set. If I vagrant ssh after these failures rbenv is set though. Could this be a problem with the rehash, as was discovered a few months back (issue #5)?

Btw, I spotted the same issue of vagrant ruby default path that was fixed on chef-rvm should also be an issue on this recipe, sous-chefs/rvm#134 That did no difference for this problem though.

Not sure how to proceed from here so I am grateful for any help I can get. :)

Using:

  • VirtualBox 4.2.4
  • Vagrant 1.0.5 (with default box "precise32").
  • Mac OS X 10.7.5

rbenv_script does not apply the rbenv environment to not_if and only_if

not_if and only_if values inside an rbenv_script call should be wrapped in the rbenv environment just as code is. Consider this example (assuming a user installed Ruby for the user "vagrant"):

rbenv_script "bundle install" do
  code "bundle install --binstubs .bundle/bin"
  cwd "/vagrant"
  user "vagrant"
  group "vagrant"
  not_if "bundle check", cwd: "/vagrant", user: "vagrant"
end

This will raise an exception on subsequent runs because rbenv is not loaded for the not_if command and bundle will not be found.

set['rbenv']['gems'] parsed incorrectly

This attribute:

set['rbenv']['gems'] = { '1.9.2-p290' => [
    { 'name'    => 'rbenv-rehash', 'version'=> '0.2' },
    { 'name'    => 'bundler', 'version' => '1.1.rc.7' },
    { 'name'    => 'chef', 'version' => '0.10.8' } ] }

Triggers this error:

Chef::Exceptions::ValidationFailed: rbenv_gem[global::rbenv-rehash] (system) (rbenv::system line 32) had an error:   Chef::Exceptions::ValidationFailed: Option rbenv_version must be a kind of String!  You passed false.

It seems that the hash key '1.9.2-p290' is not recognized as being the rbenv_version?

Problem with GEM_PATH in new Rbenv install

Hi there!

I've been using Rbenv and Chef-rbenv for a while, and am having a new problem that I haven't run in to before - was hoping you could help.

I'm "deploying" my application to a vagrant box, and using chef-ruby_build and chef-rbenv to set up the environment. I have tried both the system install and the user install - same issues.

The installation of Ruby works just fine (i.e. ruby -v outputs the correct value), however I keep getting failures along the lines of LoadError: cannot load such file -- GEM. I tried a gem env, and it is only outputting the normal Ruby gem directory - i.e. rbenv (or something) is not updating my GEM_PATH to include rbenv installed gems.

I expect there might be a simple fix, but I'm confused as to why I'm getting this error now, and was not before.

Any help would be appreciated!

brandon@app01:~$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2013-02-22 patchlevel 392) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/vagrant/local/ruby/gems
  - RUBY EXECUTABLE: /usr/local/rbenv/versions/1.9.3-p392/bin/ruby
  - EXECUTABLE DIRECTORY: /home/vagrant/local/ruby/gems/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/vagrant/local/ruby/gems
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
     - "install" => "--no-ri --no-rdoc"
     - "update" => "--no-ri --no-rdoc"
  - REMOTE SOURCES:
     - http://rubygems.org/

Cannot find a resource for rbenv_root_path on ubuntu version 8.04

Hello, can someone help me with this error in Ubuntu 8.04 (chef-solo in vagrant):

NameError
Cannot find a resource for rbenv_root_path on ubuntu version 8.04
Cookbook Trace:
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/recipes/default.rb:22:in `from_file'

Using a custom definition causes a rebuild every time chef-client runs

When using a custom build file, the full path of the file is tested in the provider (ruby_installed?)

Given this recipe:

rbenv_ruby "/usr/local/rbenv/custom/2.0.0p116"

Then every time the provider runs, it looks for the existence of

/usr/local/rbenv/versions//usr/local/rbenv/custom/2.0.0p116

doesn't find it, and kicks off rbenv install for it.

Pull request 46 addresses this by adding a definition_file attribute to the resource. In the provider, the definition to build from is set to the definition file (if defined) or the naming attribute. The directory that is tested against remains the naming attribute. The above recipe then becomes:

rbenv_ruby "2.0.0p116" do
   definition_file "/usr/local/rbenv/custom/2.0.0p116"
end

This seems the best balance between the current assumption and forcing users to name their build files specifically (e.g. assume the basename of the file is what it will be installed as).

I tried (unsuccessfully) to adapt some unit tests from another of your repos (chef-user), but ran into many conflicts between the versions of gems that chef wants to pull in and the versions the jamie gem is locked to (mainly net-ssh).

rbenv: version `global' not installed

I'm experiencing this issue when trying to bootstrap a machine, no special configuration:

I'm not sure if rbenv shell global is ever a valid command? I couldn't find a lot of Google results for that, it looks like that's an alias that chef-rbenv is assuming exists, but it doesn't.

I couldn't see the logic of calling rbenv shell global at the install phase anyway.

// /roles/base.json
{
  "name": "base",
  "chef_type": "role",
  "json_class": "Chef::Role",
  "default_attributes": {
    "rbenv": {
      "upgrade": "sync",
      "rubies": [ "1.9.3-p194", "2.0.0-p0" ],
      "gems": {
        "1.9.3-p194": [{ "name": "bundler" }],
        "2.0.0-p0": [{ "name": "bundler" }]
      },
      "global": "system"
    }
  },
  "run_list": [ "recipe[rbenv::system]", "recipe[ruby_build]" ]
}
$ librarian-chef show | egrep 'rbenv|ruby'
rbenv (0.7.3)
ruby_build (0.7.2)
================================================================================
Error executing action `run` on resource 'script[rbenv install 1.9.3-p194 (system)]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20130330-14443-a57wz3" ----
STDOUT:
STDERR: rbenv: version `global' not installed
rbenv: no such command `install'
---- End output of "bash"  "/tmp/chef-script20130330-14443-a57wz3" ----
Ran "bash"  "/tmp/chef-script20130330-14443-a57wz3" returned 1

Resource Declaration:
---------------------
# In /tmp/chef-solo/cookbooks/rbenv/providers/script.rb

 28:   script new_resource.name do
 29:     interpreter   "bash"
 30:     code          script_code
 31:     user          new_resource.user     if new_resource.user
 32:     creates       new_resource.creates  if new_resource.creates
 33:     cwd           new_resource.cwd      if new_resource.cwd
 34:     group         new_resource.group    if new_resource.group
 35:     path          new_resource.path     if new_resource.path
 36:     returns       new_resource.returns  if new_resource.returns
 37:     timeout       new_resource.timeout  if new_resource.timeout
 38:     umask         new_resource.umask    if new_resource.umask
 39:     environment(script_environment)
 40:   end
 41:

Compiled Resource:
------------------
# Declared in /tmp/chef-solo/cookbooks/rbenv/providers/script.rb:28:in `block in class_from_file'

script("rbenv install 1.9.3-p194 (system)") do
  action "run"
  retries 0
  retry_delay 2
  command "\"bash\"  \"/tmp/chef-script20130330-14443-a57wz3\""
  backup 5
  environment {"RBENV_ROOT"=>"/usr/local/rbenv"}
  returns [0]
  code "export RBENV_ROOT=\"/usr/local/rbenv\"\nexport PATH=\"${RBENV_ROOT}/bin:$PATH\"\neval \"$(rbenv init -)\"\n\nrbenv shell global\n\nrbenv install 1.9.3-p194\n"
  interpreter "bash"
  cookbook_name :rbenv
end

[2013-03-30T14:50:34+01:00] ERROR: Running exception handlers
[2013-03-30T14:50:34+01:00] ERROR: Exception handlers complete
[2013-03-30T14:50:34+01:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2013-03-30T14:50:34+01:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: script[rbenv install 1.9.3-p194 (system)] (/tmp/chef-solo/cookbooks/rbenv/providers/script.rb line 28) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20130330-14443-a57wz3" ----
STDOUT:
STDERR: rbenv: version `global' not installed
rbenv: no such command `install'
---- End output of "bash"  "/tmp/chef-script20130330-14443-a57wz3" ----
Ran "bash"  "/tmp/chef-script20130330-14443-a57wz3" returned 1
chef-solo stderr: Nothing written
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/sshkit-0.0.23/lib/sshkit/command.rb:92:in `exit_status='
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/sshkit-0.0.23/lib/sshkit/backends/netssh.rb:79:in `block (4 levels) in _execute'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/channel.rb:550:in `call'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/channel.rb:550:in `do_request'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:551:in `channel_request'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:456:in `dispatch_incoming_packets'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:213:in `preprocess'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:197:in `process'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:161:in `block in loop'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:161:in `loop'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:161:in `loop'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/sshkit-0.0.23/lib/sshkit/backends/netssh.rb:101:in `block (2 levels) in _execute'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/channel.rb:513:in `call'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/channel.rb:513:in `do_open_confirmation'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:535:in `channel_open_confirmation'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:456:in `dispatch_incoming_packets'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:213:in `preprocess'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:197:in `process'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:161:in `block in loop'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:161:in `loop'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.6/lib/net/ssh/connection/session.rb:161:in `loop'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/sshkit-0.0.23/lib/sshkit/backends/netssh.rb:103:in `block in _execute'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/sshkit-0.0.23/lib/sshkit/backends/netssh.rb:63:in `tap'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/sshkit-0.0.23/lib/sshkit/backends/netssh.rb:63:in `_execute'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/sshkit-0.0.23/lib/sshkit/backends/netssh.rb:27:in `execute'
/Users/leehambley/Projects/sshipped/chef/Capfile:94:in `block (3 levels) in <top (required)>'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/sshkit-0.0.23/lib/sshkit/backends/netssh.rb:15:in `instance_exec'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/sshkit-0.0.23/lib/sshkit/backends/netssh.rb:15:in `run'
/Users/leehambley/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/sshkit-0.0.23/lib/sshkit/runners/parallel.rb:29:in `block (2 levels) in execute'
Tasks: TOP => chef-solo:install

rbenv install 1.9.2-p290 (system) hanging

I wish I could give more info but I'm not sure where to start -- the process just hangs at the end of the install with CPU utilization dropping to 0 indefinitely.

Here's my installation recipe:

include_recipe 'ruby_build'
include_recipe 'rbenv::system'
rbenv_ruby   '1.9.2-p290'
rbenv_global  '1.9.2-p290'

And here's the output that I get:

[2012-07-06T22:37:23+00:00] INFO: Processing execute[Install ruby-build] action nothing (ruby_build::default line 38)
[2012-07-06T22:37:23+00:00] INFO: Processing directory[/home/ubuntu/provisions] action create (ruby_build::default line 48)
[2012-07-06T22:37:23+00:00] INFO: Processing git[/home/ubuntu/provisions/ruby-build] action checkout (ruby_build::default line 52)
[2012-07-06T22:37:23+00:00] INFO: git[/home/ubuntu/provisions/ruby-build] cloning repo git://github.com/sstephenson/ruby-build.git to /home/ubuntu/provisions/ruby-build
[2012-07-06T22:37:25+00:00] INFO: git[/home/ubuntu/provisions/ruby-build] checked out branch: master reference: 6e491b86f97fdb02dc891c6acab77beaac75dac3
[2012-07-06T22:37:25+00:00] INFO: git[/home/ubuntu/provisions/ruby-build] sending run action to execute[Install ruby-build] (immediate)
[2012-07-06T22:37:25+00:00] INFO: Processing execute[Install ruby-build] action run (ruby_build::default line 38)
[2012-07-06T22:37:25+00:00] INFO: execute[Install ruby-build] ran successfully
[2012-07-06T22:37:25+00:00] INFO: Processing package[git-core] action install (rbenv::system_install line 43)
[2012-07-06T22:37:25+00:00] INFO: Processing package[grep] action install (rbenv::system_install line 43)
[2012-07-06T22:37:25+00:00] INFO: Processing template[/etc/profile.d/rbenv.sh] action create (rbenv::system_install line 29)
[2012-07-06T22:37:25+00:00] INFO: template[/etc/profile.d/rbenv.sh] mode changed to 755
[2012-07-06T22:37:25+00:00] INFO: template[/etc/profile.d/rbenv.sh] updated content
[2012-07-06T22:37:25+00:00] INFO: Processing git[/usr/local/rbenv] action checkout (rbenv::system_install line 61)
[2012-07-06T22:37:25+00:00] INFO: git[/usr/local/rbenv] cloning repo git://github.com/sstephenson/rbenv.git to /usr/local/rbenv
[2012-07-06T22:37:26+00:00] INFO: git[/usr/local/rbenv] checked out branch: master reference: 6778c8e905d774d4dc70724c455e6fcff4c1d3e1
[2012-07-06T22:37:26+00:00] INFO: Processing bash[Initialize rbenv (system)] action run (rbenv::system_install line 80)
[2012-07-06T22:37:26+00:00] INFO: bash[Initialize rbenv (system)] ran successfully
[2012-07-06T22:37:26+00:00] INFO: Processing log[rbenv-post-init-system] action write (rbenv::system_install line 87)
[2012-07-06T22:37:26+00:00] INFO: rbenv-post-init-system
[2012-07-06T22:37:26+00:00] INFO: Processing rbenv_ruby[1.9.2-p290] (system) action install (base::ruby line 5)
[2012-07-06T22:37:26+00:00] INFO: Processing package[build-essential] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:37:26+00:00] INFO: Processing package[bison] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:38:02+00:00] INFO: package[bison] installed version 1:2.5.dfsg-2.1
[2012-07-06T22:38:02+00:00] INFO: Processing package[openssl] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:38:03+00:00] INFO: Processing package[libreadline6] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:38:03+00:00] INFO: Processing package[libreadline6-dev] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:38:06+00:00] INFO: package[libreadline6-dev] installed version 6.2-8
[2012-07-06T22:38:06+00:00] INFO: Processing package[zlib1g] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:38:06+00:00] INFO: Processing package[zlib1g-dev] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:38:06+00:00] INFO: Processing package[libssl-dev] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:38:55+00:00] INFO: package[libssl-dev] installed version 1.0.1-4ubuntu3
[2012-07-06T22:38:55+00:00] INFO: Processing package[libyaml-dev] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:38:58+00:00] INFO: package[libyaml-dev] installed version 0.1.4-2
[2012-07-06T22:38:58+00:00] INFO: Processing package[libsqlite3-0] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:38:58+00:00] INFO: Processing package[libsqlite3-dev] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:39:01+00:00] INFO: package[libsqlite3-dev] installed version 3.7.9-2ubuntu1
[2012-07-06T22:39:01+00:00] INFO: Processing package[sqlite3] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:39:05+00:00] INFO: package[sqlite3] installed version 3.7.9-2ubuntu1
[2012-07-06T22:39:05+00:00] INFO: Processing package[libxml2-dev] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:39:44+00:00] INFO: package[libxml2-dev] installed version 2.7.8.dfsg-5.1ubuntu4
[2012-07-06T22:39:44+00:00] INFO: Processing package[libxslt1-dev] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:40:39+00:00] INFO: package[libxslt1-dev] installed version 1.1.26-8ubuntu1
[2012-07-06T22:40:39+00:00] INFO: Processing package[autoconf] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:40:44+00:00] INFO: package[autoconf] installed version 2.68-1ubuntu2
[2012-07-06T22:40:44+00:00] INFO: Processing package[libc6-dev] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:40:44+00:00] INFO: Processing package[ssl-cert] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:40:48+00:00] INFO: package[ssl-cert] installed version 1.0.28
[2012-07-06T22:40:48+00:00] INFO: Processing package[subversion] action install (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:18+00:00] INFO: package[subversion] installed version 1.6.17dfsg-3ubuntu3
[2012-07-06T22:41:18+00:00] INFO: Building rbenv_ruby[1.9.2-p290] (system), this could take a while...
[2012-07-06T22:41:18+00:00] INFO: Processing rbenv_script[rbenv install 1.9.2-p290 (system)] action run (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 59)
[2012-07-06T22:41:18+00:00] INFO: Processing package[build-essential] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:18+00:00] INFO: Processing package[bison] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:18+00:00] INFO: Processing package[openssl] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:18+00:00] INFO: Processing package[libreadline6] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:18+00:00] INFO: Processing package[libreadline6-dev] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:18+00:00] INFO: Processing package[zlib1g] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:18+00:00] INFO: Processing package[zlib1g-dev] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:18+00:00] INFO: Processing package[libssl-dev] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:18+00:00] INFO: Processing package[libyaml-dev] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:19+00:00] INFO: Processing package[libsqlite3-0] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:19+00:00] INFO: Processing package[libsqlite3-dev] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:19+00:00] INFO: Processing package[sqlite3] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:19+00:00] INFO: Processing package[libxml2-dev] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:19+00:00] INFO: Processing package[libxslt1-dev] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:19+00:00] INFO: Processing package[autoconf] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:19+00:00] INFO: Processing package[libc6-dev] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:19+00:00] INFO: Processing package[ssl-cert] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:19+00:00] INFO: Processing package[subversion] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 97)
[2012-07-06T22:41:19+00:00] INFO: Processing rbenv_script[rbenv install 1.9.2-p290 (system)] action nothing (/home/ubuntu/provisions/cookbooks/rbenv/providers/ruby.rb line 59)
[2012-07-06T22:41:19+00:00] INFO: Processing script[rbenv install 1.9.2-p290 (system)] action run (/home/ubuntu/provisions/cookbooks/rbenv/providers/script.rb line 28)

Environment: chef-solo, ubuntu 12.04, ec2 micro instance

Initial bootstrapping not working

  "rbenv" => {
    "git_ref" => "v0.4.0",
    "rubies" => ["1.9.3-p374"],
    'global' => '1.9.3-p374',
    "gems" => {
      "1.9.3-p374" => [{"name" => "bundler"}]
    }
  },
require_recipe 'ruby_build'
require_recipe 'rbenv::system'

Results in this:

[2013-01-24T16:49:16-08:00] INFO: Processing script[rbenv install 1.9.3-p374 (system)] action run (/opt/chef-solo/current/cookbooks/rbenv/providers/script.rb line 28)

================================================================================
Error executing action `run` on resource 'script[rbenv install 1.9.3-p374 (system)]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20130124-17061-1l3nqso" ----
STDOUT: 
STDERR: rbenv: version `global' not installed
rbenv: no such command `install'
---- End output of "bash"  "/tmp/chef-script20130124-17061-1l3nqso" ----
Ran "bash"  "/tmp/chef-script20130124-17061-1l3nqso" returned 1

How do I specify the ruby version I can install ?

I'm new to Chef and I don't understand the way they use LWRP, this is my Vagrantfile

Vagrant::Config.run do |config|
  config.vm.box = "lucid32"
  config.vm.network :hostonly, "33.33.33.33"
  config.vm.customize do |vm|
    vm.memory_size = 386
  end
  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 "openssl"
    chef.add_recipe "postgresql"
    chef.add_recipe "ruby_build"
    chef.add_recipe "rbenv"
    chef.add_recipe "unicorn"
  end
end

Cannot use rbenv / ruby_build on centos 6.3 (in Vagrant and in EC2)

I have a recipe with the following line in a recipe:

rbenv_global "1.9.3-p327"

And I have tried including all permutations of the following 3 recipes in my run list to make it work (on both Vagrant with a centos 6.3 box and in EC2 with a centos 6.3 ami):

rbenv::system
rbenv::system_install
rbenv::vagrant

I receive the following error:

[2013-03-13T16:43:48+00:00] FATAL: NameError: Cannot find a resource for rbenv on centos version 6.3

Allow additional environment variables for rbenv_ruby ( eg CONFIGURE_OPTS )

Just putting it out there that it would be awesome to allow chef-rbenv's rbenv_ruby to be similar to chef-ruby_build's ruby_build_ruby with regards to the additional environment variables.

Making both the providers be the same would allow someone using chef-rbenv to specify CONFIGURE_OPTS without resorting to using chef-ruby_build.

Also a bonus would be that the default system install from node attributes could allow access to these environment variables.

Thoughts?

( happy to make a pull request, just jotting this down as I've been caught out by a segmentation fault because of openssl not being included )

Installing gems from a path does not work as documented

I'm trying to follow the documented rbenv_gem syntax for installing a gem from a path. The example shows:

rbenv_gem "json" do
  rbenv_version   "ree-1.8.7-2011.03"
  source          "/tmp/json-1.5.1.gem"
  version         "1.5.1"
end

Using this syntax, I attempted to install a local gem called "demo_setup.gem" with this in my recipe:

rbenv_gem "demo_setup" do
   source "/srv/app/current/demo_setup.gem"
 end

However, this generates a broken "gem" command line that looks like this:

[2014-05-02T21:59:43+00:00] ERROR: rbenv_gem[demo_setup] (app_mojolingo_demo::app line 119) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/rbenv/versions/2.1.0/bin/gem install demo_setup -q --no-rdoc --no-ri  -v "0.0.1"   --source=/srv/app/current/demo_setup.gem --source=http://rubygems.org ----
STDOUT:
STDERR: ERROR:  While executing gem ... (OptionParser::InvalidArgument)
invalid argument: --source=/srv/app/current/demo_setup.gem
---- End output of /opt/rbenv/versions/2.1.0/bin/gem install demo_setup -q --no-rdoc --no-ri  -v "0.0.1"   --source=/srv/app/current/demo_setup.gem --source=http://rubygems.org ----

Error installing gem

I am using chef-solo 11.6.0.

Using the following node file:

{
   "rbenv": {
      "user_installs": [{
          "user":  "vagrant",
          "rubies"  : ["2.0.0-p247"],
          "global"  : "2.0.0-p247",
          "gems"    : {
            "2.0.0-p247"  : [
              { "name"    : "bundler" },
              { "name"    : "rake" }
            ]
          }
        }]
    },

      "run_list": [          
         "recipe[ruby_build]",
         "recipe[rbenv::user]"
      ]
}

getting the following exception:

Mixlib::ShellOut::ShellCommandFailed: rbenv_gem[2.0.0-p247::rake (vagrant)] (vagrant) (rbenv::user line 53) had an error: 
Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of export RBENV_ROOT="/home/vagrant/.rbenv" && export PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH" && 
export RBENV_VERSION="2.0.0-p247" && $RBENV_ROOT/shims/gem install rake -q --no-rdoc --no-ri -v "10.1.0" ----
STDOUT: 
STDERR: ERROR:  Error installing rake:
        "rake" from rake conflicts with /home/vagrant/.rbenv/versions/2.0.0-p247/bin/rake
---- End output of export RBENV_ROOT="/home/vagrant/.rbenv" && export PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH" && ex
port RBENV_VERSION="2.0.0-p247" && $RBENV_ROOT/shims/gem install rake -q --no-rdoc --no-ri -v "10.1.0" ----
Ran export RBENV_ROOT="/home/vagrant/.rbenv" && export PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH" && export RBENV_VERS
ION="2.0.0-p247" && $RBENV_ROOT/shims/gem install rake -q --no-rdoc --no-ri -v "10.1.0" returned 1
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.2.0/lib/mixlib/shellout.rb:251:in `invalid!'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.2.0/lib/mixlib/shellout.rb:237:in `error!'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/mixin/shell_out.rb:36:in `shell_out!'
/home/vagrant/chef-solo/cookbooks-1/rbenv/libraries/chef_rbenv_mixin.rb:30:in `shell_out!'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/provider/package/rubygems.rb:538:in `install_via_gem_comm
and'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/provider/package/rubygems.rb:522:in `install_package'
/home/vagrant/chef-solo/cookbooks-1/rbenv/libraries/chef_provider_package_rbenvrubygems.rb:66:in `install_package'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/provider/package.rb:82:in `block in action_install'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/mixin/why_run.rb:52:in `call'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/mixin/why_run.rb:52:in `add_action'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/provider.rb:149:in `converge_by'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/provider/package.rb:80:in `action_install'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/provider.rb:114:in `run_action'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/resource.rb:625:in `run_action'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/runner.rb:49:in `run_action'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/runner.rb:81:in `block (2 levels) in converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/runner.rb:81:in `each'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/runner.rb:81:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/resource_collection.rb:98:in `block in execute_each_resou
rce'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_ite
rator_block'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with
_index'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/resource_collection.rb:96:in `execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/runner.rb:80:in `converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/client.rb:429:in `converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/client.rb:494:in `do_run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/client.rb:199:in `block in run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/client.rb:193:in `fork'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/client.rb:193:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/application.rb:183:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/application/solo.rb:239:in `block in run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/application/solo.rb:231:in `loop'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/application/solo.rb:231:in `run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/application.rb:66:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/bin/chef-solo:25:in `<top (required)>'
/usr/bin/chef-solo:23:in `load'
/usr/bin/chef-solo:23:in `<main>'

Says Ruby version is installed but I can't see it

The cookbook seems to be saying that this system ruby is up-to-date but it doesn't seem to be installed. I am running on Ubuntu.

I have this in my recipe:

rbenv_ruby node['kibana']['ruby_version'] do
  action :install
  root_path node['rbenv']['root_path']
end

rbenv_global node['kibana']['ruby_version'] do
  root_path node['rbenv']['root_path']
end

and I see this message:

  * rbenv_ruby[1.9.3-p125] (system) action install (up to date)
  * rbenv_global[1.9.3-p125] (system) action createRecipe: <Dynamically Defined Resource>
  * rbenv_script[rbenv global 1.9.3-p125 (system)] action run

  * rbenv_script[rbenv global 1.9.3-p125 (system)] action nothing (up to date)
  * script[rbenv global 1.9.3-p125 (system)] action run
================================================================================
Error executing action `run` on resource 'script[rbenv global 1.9.3-p125 (system)]'
================================================================================


Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20130219-24765-czoav7" ----
STDOUT: 
STDERR: rbenv: version `global' not installed
rbenv: version `1.9.3-p125' not installed

Breaks in Chef 10

We're using Chef 10 and "use_inline_provider" in /opt/chef-solo/current/cookbooks/rbenv/providers/global.rb throws:

NameError
---------
undefined local variable or method `use_inline_resources' for #<Class:0x00000002b06498>

Allow setting ruby-build environment variables

I'm adding this in chef-rbenv because it exposes the high-level LWRP to install rubies.

ruby-build has several nice env vars which can be used with some vagrant magic to avoid building the same ruby over and over:

https://github.com/sstephenson/ruby-build#special-environment-variables

It would nice to be able to set them since it looks like Chef explicitly sets the child command's environment so I don't believe I can just set ENV[xxx] = '/foo/bar' in my recipe.

rbenv: cannot change working directory to `/root'

Using include_recipe 'rbenv::user' triggers the error below. seems to be related to this issue

Generated at 2012-06-04 13:27:02 +1000
Chef::Exceptions::ShellCommandFailed: bash[Initialize rbenv (hedge)] (rbenv::user_install line 80) had an error: Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20120604-17817-11mtszz" ----
STDOUT: export PATH="/home/hedge/.rbenv/shims:${PATH}"
source "/home/hedge/.rbenv/libexec/../completions/rbenv.bash"
rbenv rehash 2>/dev/null
STDERR: rbenv: cannot change working directory to `/root'
---- End output of "bash"  "/tmp/chef-script20120604-17817-11mtszz" ----
Ran "bash"  "/tmp/chef-script20120604-17817-11mtszz" returned 1
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/shell_out.rb:206:in `invalid!'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/shell_out.rb:192:in `error!'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/shell_out.rb:36:in `shell_out!'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/provider/execute.rb:58:in `action_run'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/provider/script.rb:33:in `action_run'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource.rb:440:in `run_action'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:45:in `run_action'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in `block (2 levels) in converge'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in `each'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in `block in converge'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection.rb:94:in `block in execute_each_resource'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection.rb:92:in `execute_each_resource'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:76:in `converge'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:312:in `converge'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:160:in `run'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:192:in `block in run_application'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `loop'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `run_application'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application.rb:67:in `run'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/bin/chef-solo:25:in `<top (required)>'
/root/.rbenv/versions/1.9.2-p290/bin/chef-solo:19:in `load'
/root/.rbenv/versions/1.9.2-p290/bin/chef-solo:19:in `<main>'

berks install fails

I installed chef-rbenv for the first time. I get this error when I run berks install

Failed to download 'rbenv' from git: 'git://github.com/fnichol/chef-rbenv.git' with branch: 'v0.7.2'
Cookbook 'rbenv' not found in any of the default locations

I have lines in Berkshelf.

cookbook 'rbenv',
  :git => 'git://github.com/fnichol/chef-rbenv.git', :branch => 'v0.7.2'

And these are versions of chef and git

$ knife --version
Chef: 11.12.0.alpha.1
$ git --version
git version 1.8.5.2 (Apple Git-48)

Am I doing something wrong?
What can I do to use this cookbook?

How to install/use rbenv + ruby-build?

Hi,

I've been trying for quite a bunch of hours now and I simply cannot figure out how this works. I'm trying to get a user install going for my deployer user. I would like to install jruby-1.6.7 and the jruby-openssl gem. I would like to set jruby-1.6.7 as the global/default ruby.

My main recipe (the only one in the run_list):

include_recipe "java"
include_recipe "ruby_build"
include_recipe "rbenv::user"

user "deployer" do
  password "myshadowpass"
  home "/home/deployer"
  supports :manage_home => true
  shell "/bin/bash"
end

# Installs JRuby for deployer?
rbenv_ruby "jruby-1.6.7" do
  user "deployer"
end

# Installs JRuby for deployer? Sets JRuby global? Installs jruby-openssl?
node['rbenv']['user_installs'] = [
  { 'user'    => 'deployer',
    'rubies'  => ['jruby-1.6.7'],
    'global'  => 'jruby-1.6.7',
    'gems'    => {
      'jruby-1.6.7' => [
        { 'name' => 'jruby-openssl' }
      ]
    }
  }
]

When I run this on the server (through knife cook) I get this:

[Mon, 09 Apr 2012 07:57:25 -0700] INFO: *** Chef 0.10.8 ***
[Mon, 09 Apr 2012 07:57:25 -0700] INFO: Setting the run_list to ["recipe[main]"] from JSON
[Mon, 09 Apr 2012 07:57:25 -0700] INFO: Run List is [recipe[main]]
[Mon, 09 Apr 2012 07:57:25 -0700] INFO: Run List expands to [main]
[Mon, 09 Apr 2012 07:57:25 -0700] INFO: Starting Chef Run for lucid32
[Mon, 09 Apr 2012 07:57:25 -0700] INFO: Running start handlers
[Mon, 09 Apr 2012 07:57:25 -0700] INFO: Start handlers complete.
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[curl] action install (main::default line 3)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[git-core] action install (main::default line 3)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[htop] action install (main::default line 3)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[vim] action install (main::default line 3)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing ruby_block[set-env-java-home] action create (java::openjdk line 36)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: ruby_block[set-env-java-home] called
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing ruby_block[update-java-alternatives] action nothing (java::openjdk line 43)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[openjdk-6-jdk] action install (java::openjdk line 79)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[tar] action install (ruby_build::default line 34)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[bash] action install (ruby_build::default line 34)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[curl] action install (ruby_build::default line 34)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[git-core] action install (ruby_build::default line 34)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing execute[Install ruby-build] action nothing (ruby_build::default line 38)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing directory[/tmp/chef-solo] action create (ruby_build::default line 48)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing git[/tmp/chef-solo/ruby-build] action checkout (ruby_build::default line 52)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[git-core] action install (rbenv::user_install line 43)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[grep] action install (rbenv::user_install line 43)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing user[deployer] action create (main::default line 15)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing rbenv_ruby[jruby-1.6.7] (deployer) action install (main::default line 23)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[g++] action install (/tmp/chef-solo/cookbooks/rbenv/providers/ruby.rb line 95)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Building rbenv_ruby[jruby-1.6.7] (deployer), this could take a while...
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing rbenv_script[rbenv install jruby-1.6.7 (deployer)] action run (/tmp/chef-solo/cookbooks/rbenv/providers/ruby.rb line 59)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing package[g++] action nothing (/tmp/chef-solo/cookbooks/rbenv/providers/ruby.rb line 95)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing rbenv_script[rbenv install jruby-1.6.7 (deployer)] action nothing (/tmp/chef-solo/cookbooks/rbenv/providers/ruby.rb line 59)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: Processing script[rbenv install jruby-1.6.7 (deployer)] action run (/tmp/chef-solo/cookbooks/rbenv/providers/script.rb line 28)
[Mon, 09 Apr 2012 07:57:26 -0700] INFO: script[rbenv install jruby-1.6.7 (deployer)] sh("bash"  "/tmp/chef-script20120409-8817-1y28ets-0")
[Mon, 09 Apr 2012 07:57:26 -0700] ERROR: script[rbenv install jruby-1.6.7 (deployer)] (/tmp/chef-solo/cookbooks/rbenv/providers/script.rb line 28) has had an error
[Mon, 09 Apr 2012 07:57:26 -0700] ERROR: script[rbenv install jruby-1.6.7 (deployer)] (/tmp/chef-solo/cookbooks/rbenv/providers/script.rb:28:in `class_from_file') had an error:
script[rbenv install jruby-1.6.7 (deployer)] (/tmp/chef-solo/cookbooks/rbenv/providers/script.rb line 28) had an error: Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but received '127'
---- Begin output of "bash"  "/tmp/chef-script20120409-8817-1y28ets-0" ----
STDOUT: 
STDERR: /tmp/chef-script20120409-8817-1y28ets-0: line 3: rbenv: command not found
/tmp/chef-script20120409-8817-1y28ets-0: line 5: rbenv: command not found
/tmp/chef-script20120409-8817-1y28ets-0: line 7: rbenv: command not found
---- End output of "bash"  "/tmp/chef-script20120409-8817-1y28ets-0" ----
Ran "bash"  "/tmp/chef-script20120409-8817-1y28ets-0" returned 127
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/shell_out.rb:206:in `invalid!'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/shell_out.rb:192:in `error!'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/mixin/shell_out.rb:36:in `shell_out!'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/provider/execute.rb:58:in `action_run'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/provider/script.rb:33:in `action_run'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource.rb:440:in `send'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource.rb:440:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:45:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:81:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:81:in `each'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:81:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection.rb:94
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection.rb:92:in `execute_each_resource'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:76:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/client.rb:312:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/client.rb:160:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/application/solo.rb:192:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/application/solo.rb:183:in `loop'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/application/solo.rb:183:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/application.rb:67:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/chef-solo:25
/usr/bin/chef-solo:19:in `load'
/usr/bin/chef-solo:19
[Mon, 09 Apr 2012 07:57:26 -0700] ERROR: Running exception handlers
[Mon, 09 Apr 2012 07:57:26 -0700] ERROR: Exception handlers complete
[Mon, 09 Apr 2012 07:57:26 -0700] FATAL: Stacktrace dumped to /tmp/chef-solo/chef-stacktrace.out
[Mon, 09 Apr 2012 07:57:26 -0700] FATAL: Chef::Exceptions::ShellCommandFailed: script[rbenv install jruby-1.6.7 (deployer)] (/tmp/chef-solo/cookbooks/rbenv/providers/script.rb line 28) had an error: Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but received '127'
---- Begin output of "bash"  "/tmp/chef-script20120409-8817-1y28ets-0" ----
STDOUT: 
STDERR: /tmp/chef-script20120409-8817-1y28ets-0: line 3: rbenv: command not found
/tmp/chef-script20120409-8817-1y28ets-0: line 5: rbenv: command not found
/tmp/chef-script20120409-8817-1y28ets-0: line 7: rbenv: command not found
---- End output of "bash"  "/tmp/chef-script20120409-8817-1y28ets-0" ----
Ran "bash"  "/tmp/chef-script20120409-8817-1y28ets-0" returned 127

It seems to never be able to find rbenv or ruby_build or whatever commands there are when working with both tools.

Do you see what I'm doing wrong?

Any help much appreciated!

Note:

  • Ubuntu 10.04
  • Vagrant Instance (but using deployer user, not the vagrant user)

Please release new features as release

We run a 'strict' environment where /tmp is mounted with noexec, thus we need environment variable capabilities to modify where temporary files go during a ruby-build install run. We're using master for now, but isn't it time for a release soon?

readline error installing ruby 2.1.1

Installing ruby-2.1.1...

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20140420001434.15330
Results logged to /tmp/ruby-build.20140420001434.15330.log

Last 10 log lines:
^
readline.c: At top level:
readline.c:634:1: warning: 'readline_pre_input_hook' defined but not used [-Wunused-function]
readline_pre_input_hook(void)
^
make[2]: *** [readline.o] Error 1
make[2]: Leaving directory /tmp/ruby-build.20140420001434.15330/ruby-2.1.1/ext/readline' make[1]: *** [ext/readline/all] Error 2 make[1]: Leaving directory/tmp/ruby-build.20140420001434.15330/ruby-2.1.1'
make: *** [build-ext] Error 2
---- End output of "bash" "/tmp/chef-script20140420-14697-kqkljd" ----
Ran "bash" "/tmp/chef-script20140420-14697-kqkljd" returned 1
[2014-04-20T00:18:18+02:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.

ruby-1.9.3-p392 fails to build

On Mountain Lion, with i686-apple-darwin11-llvm-gcc-4.2 installed:

Recipe: rbenv::user
  * rbenv_ruby[1.9.3-p392 (stephen)] (stephen) action installRecipe: <Dynamically Defined Resource>
  * rbenv_script[rbenv install 1.9.3-p392 (stephen)] action run



  * rbenv_script[rbenv install 1.9.3-p392 (stephen)] action nothing (up to date)
  * script[rbenv install 1.9.3-p392 (stephen)] action run
================================================================================
Error executing action `run` on resource 'script[rbenv install 1.9.3-p392 (stephen)]'
================================================================================


Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20130225-11972-84e9lw" ----
STDOUT: 
STDERR: rbenv: version `global' not installed
Downloading yaml-0.1.4.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/36c852831d02cf90508c29852361d01b
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /Users/stephen/.rbenv/versions/1.9.3-p392

Downloading ruby-1.9.3-p392.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
Installing ruby-1.9.3-p392...

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20130225153220.12196
Results logged to /tmp/ruby-build.20130225153220.12196.log

Last 10 log lines:
compiling safe.c
compiling signal.c
compiling sprintf.c
compiling st.c
st.c:520:35: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
            i = table->num_entries++;
              ~ ~~~~~~~~~~~~~~~~~~^~
1 error generated.
make: *** [st.o] Error 1
make: *** Waiting for unfinished jobs....
---- End output of "bash"  "/tmp/chef-script20130225-11972-84e9lw" ----
Ran "bash"  "/tmp/chef-script20130225-11972-84e9lw" returned 1


Resource Declaration:
---------------------
# In /Users/stephen/src/rbenv/providers/script.rb

 28:   script new_resource.name do
 29:     interpreter   "bash"
 30:     code          script_code
 31:     user          new_resource.user     if new_resource.user
 32:     creates       new_resource.creates  if new_resource.creates
 33:     cwd           new_resource.cwd      if new_resource.cwd
 34:     group         new_resource.group    if new_resource.group
 35:     path          new_resource.path     if new_resource.path
 36:     returns       new_resource.returns  if new_resource.returns
 37:     timeout       new_resource.timeout  if new_resource.timeout
 38:     umask         new_resource.umask    if new_resource.umask
 39:     environment(script_environment)
 40:   end
 41: 



Compiled Resource:
------------------
# Declared in /Users/stephen/src/rbenv/providers/script.rb:28:in `block in class_from_file'

script("rbenv install 1.9.3-p392 (stephen)") do
  action "run"
  retries 0
  retry_delay 2
  command "\"bash\"  \"/tmp/chef-script20130225-11972-84e9lw\""
  backup 5
  environment {"RBENV_ROOT"=>"/Users/stephen/.rbenv", "USER"=>"stephen", "HOME"=>"/Users/stephen"}
  returns [0]
  user "stephen"
  code "export RBENV_ROOT=\"/Users/stephen/.rbenv\"\nexport PATH=\"${RBENV_ROOT}/bin:$PATH\"\neval \"$(rbenv init -)\"\n\nrbenv shell global\n\nrbenv install 1.9.3-p392\n"
  interpreter "bash"
  cookbook_name :rbenv
end



[2013-02-25T15:35:22+00:00] ERROR: Running exception handlers
[2013-02-25T15:35:22+00:00] ERROR: Exception handlers complete
Chef Client failed. 6 resources updated
[2013-02-25T15:35:22+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2013-02-25T15:35:22+00:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: script[rbenv install 1.9.3-p392 (stephen)] (/Users/stephen/src/rbenv/providers/script.rb line 28) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20130225-11972-84e9lw" ----
STDOUT: 
STDERR: rbenv: version `global' not installed
Downloading yaml-0.1.4.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/36c852831d02cf90508c29852361d01b
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /Users/stephen/.rbenv/versions/1.9.3-p392

Downloading ruby-1.9.3-p392.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
Installing ruby-1.9.3-p392...

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20130225153220.12196
Results logged to /tmp/ruby-build.20130225153220.12196.log

Last 10 log lines:
compiling safe.c
compiling signal.c
compiling sprintf.c
compiling st.c
st.c:520:35: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
            i = table->num_entries++;
              ~ ~~~~~~~~~~~~~~~~~~^~
1 error generated.
make: *** [st.o] Error 1
make: *** Waiting for unfinished jobs....
---- End output of "bash"  "/tmp/chef-script20130225-11972-84e9lw" ----
Ran "bash"  "/tmp/chef-script20130225-11972-84e9lw" returned 1

This looks very similar to: rbenv/ruby-build#297

I wonder if this means ruby-build is using clang rather than gcc?

recipe[rbenv::system_install] not adding to .bashrc

The recipe works good with installing ruby and setting the default ruby version, however, it doesn't append the PATH and rbenv init to my /etc/bash.bashrc. I'm still new to chef, so do I need to use a separate provider to do this? I see that there is a script provider that appears to do this.

I'm on Ubuntu 11.10

user installed gems are owned by root instead of user

When specifying a gem to be installed for a user the gem files are owned by root instead the user.

rbenv_gem "passenger-enterprise-server" do
rbenv_version "1.9.3p448"
source "/tmp/passenger-enterprise-server-4.0.8.gem"
user "app"
end

The passenger gem in this case should be owned by the "app" user but instead are owned by root.

Chef::Exceptions::RecipeNotFound: could not find recipe user for cookbook rbenv

Once I start to bootstrap a server it gives me a error:

could not find user recipe for cookbook rbenv

But the recipe is in the recipes folder. I can not get it to work even if I define the recipe in the role as well.

recipe rbenv
recipe rbenv::user

This is how I try to install user ruby in role:

:rbenv => {
:user_rubies => ['1.9.3-p392'],
:global => '1.9.3-p392',
:user_installs => [
{
:user => 'rubyuser',
:global => '1.9.3-p392',
:rubies => ['1.9.3-p392'],
:gems => {
'1.9.3-p392' => [
{ :name => 'bundler' },
{ :name => 'capistrano' },
]
}
}
]
},

I have tried to add user.rb recipe and user_install.rb recipe to rbenv cookbook in server /var/chef/cache/cookbooks/rbenv/recipes/ folder by hand, but that does not help me either. Theres nothing that needs rbenv before it runs the rbenv install. It gives me the error when it starts to install it.

Please help me.

Chef 11 upload error

When attempting to upload to a chef-11 server using ruby 1.9.3 / knife 11.8.0, I get the following errors:

FATAL: Cookbook file libraries/provider_rbenv_rubygems.rb has a ruby syntax error:
FATAL: /Users/jhmartin/.librarian/tmp/chef/integration/knife/install/3f9366334334ffdb67f9f53491e49d32/rbenv/libraries/provider_rbenv_rubygems.rb:46: syntax error, unexpected ':', expecting ')'
FATAL: options.merge!(env: {
FATAL: ^
FATAL: /Users/jhmartin/.librarian/tmp/chef/integration/knife/install/3f9366334334ffdb67f9f53491e49d32/rbenv/libraries/provider_rbenv_rubygems.rb:50: syntax error, unexpected ')', expecting kEND
FATAL: /Users/jhmartin/.librarian/tmp/chef/integration/knife/install/3f9366334334ffdb67f9f53491e49d32/rbenv/libraries/provider_rbenv_rubygems.rb:51: syntax error, unexpected tIDENTIFIER, expecting tAMPER
FATAL: original_shell_out!(*args, options)
FATAL: ^
FATAL: /Users/jhmartin/.librarian/tmp/chef/integration/knife/install/3f9366334334ffdb67f9f53491e49d32/rbenv/libraries/provider_rbenv_rubygems.rb:100: syntax error, unexpected $end, expecting kEND

permissions on ~/.rbenv

I'm trying to install passenger in rbenv environment

rbenv_script "passenger-install-nginx-module --auto --prefix=/opt/nginx --auto-download" do
  user "vagrant"
  rbenv_version "1.9.2-p290"
  cwd  "/tmp"
  code %{passenger-install-nginx-module --auto --prefix=/opt/nginx --auto-download}
end

and getting

Permission problems

This installer must be able to write to the following directory:

  /home/vagrant/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/passenger-3.0.12

But it can't do that, because you're running the installer as vagrant.
Please re-run this installer as root.

but i wondered why i have no rights to write /home/vagrant/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/passenger-3.0.12
?

on the box:

vagrant@precise64:~$ ls -la | grep rbenv
drwxr-xr-x 9 vagrant root    4096 Jun  1 14:52 .rbenv

it looks like wrong for me that .rbenv is owned by vagrant:root

ruby_build not detected when using include_recipe

If you include and run the ruby_build cookbook by calling include_recipe from another cookbook, chef-rbenv fails to install Ruby using the rbenv::system recipe. It only works if you include ruby_build explicitly in the node's run list.

The problem seems to be the method ruby_build_missing? in the Ruby provider, which calls node.recipe?. Apparently this doesn't account for recipes included during the Chef run.

I'm using Chef 11.4.0.

Unable to install gems

I get the following error when I try to provision my Ubuntu vagrant box:

[2013-03-04T18:15:01-03:00] INFO: Processing rbenv_gem[1.9.3-p392::bundler (vagrant)] (vagrant) action install (rbenv::user line 44)

================================================================================
Error executing action `install` on resource 'rbenv_gem[1.9.3-p392::bundler (vagrant)] (vagrant)'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '127'
---- Begin output of  env gempath ----
STDOUT:
STDERR: env: gempath: No such file or directory
---- End output of  env gempath ----
Ran  env gempath returned 127

Cookbook Trace:
---------------
/tmp/vagrant-chef-1/chef-solo-2/cookbooks/rbenv-3b1c59abc1134a50b0b8844954eca9a566aaffb8/libraries/chef_rbenv_mixin.rb:30:in `shell_out!'

Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/recipes/user.rb

 44:       rbenv_gem "#{gem['name']} (#{rbenv_user['user']})" do
 45:         package_name    gem['name']
 46:         user            rbenv_user['user']
 47:         root_path       rbenv_user['root_path'] if rbenv_user['root_path']
 48:         rbenv_version   rubie
 49:
 50:         %w{version action options source}.each do |attr|
 51:           send(attr, gem[attr]) if gem[attr]
 52:         end
 53:       end
 54:     end

Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/recipes/user.rb:44:in `from_file'

rbenv_gem("bundler (vagrant)") do
  retries 0
  recipe_name "user"
  cookbook_name :rbenv
  gem_binary "export RBENV_ROOT=\"/opt/rbenv\" && export PATH=\"$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH\" && export RBENV_VERSION=\"1.9.3-p392\" && $RBENV_ROOT/shims/gem"
  rbenv_version "1.9.3-p392"
  action :install
  user "vagrant"
  package_name "bundler"
  retry_delay 2
  provider Chef::Provider::Package::RbenvRubygems
end

[2013-03-04T18:15:01-03:00] ERROR: Running exception handlers
[2013-03-04T18:15:01-03:00] ERROR: Exception handlers complete
[2013-03-04T18:15:01-03:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-03-04T18:15:01-03:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: rbenv_gem[1.9.3-p392::bundler (vagrant)] (vagrant) (rbenv::user line 44) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '127'
---- Begin output of  env gempath ----
STDOUT:
STDERR: env: gempath: No such file or directory
---- End output of  env gempath ----
Ran  env gempath returned 127
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

Here is the provisioning section of my Vagrantfile:

  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = "~/.berkshelf/cookbooks"
    chef.add_recipe "apt"
    chef.add_recipe 'build-essential'
    chef.add_recipe 'git'
    chef.add_recipe 'vim'
    chef.add_recipe 'tmux'
    chef.add_recipe 'nginx'
    chef.add_recipe 'postgresql'
    chef.add_recipe 'stunnel'
    chef.add_recipe 'homesick'
    chef.add_recipe 'vagrant-fixes'
    chef.add_recipe 'haproxy'

    chef.add_recipe 'ruby_build'
    chef.add_recipe 'rbenv::vagrant'
    chef.add_recipe 'rbenv::user'

    chef.json = {
      'rbenv' => {
        'user_installs' => [{
          'user' => 'vagrant',
          'rubies' => ['1.9.3-p392'],
          'global' => '1.9.3-p392',
          'gems' => {
            '1.9.3-p392' => [
              {'name' => 'bundler'},
              {'name' => 'rake'},
              {'name' => 'irb'},
              {'name' => 'pry'}
            ]
          }
        }]
      },

      'homesick_castles' => {
        'dotfiles' => {
          'name' => 'lynn',
          'source' => 'https://github.com/lynndylanhurley/lynn-dotfiles.git'
        }
      }
    }

  end

Is this a bug, or am I doing something wrong here?

Here is my complete Vagrantfile:
https://gist.github.com/5085788

And here is my Berksfile:
https://gist.github.com/5085791

Per user global version

Let me know if I missed something.

I have 1.8.7 global. I would like to be able to set user specific global versions.

I am modifying chef-rbenv to accept a user_versions array and simply create the file .ruby-version in the user's root directory. I have tried a variety of configuration options but I am trying to avoid re-installing ruby for each user since space on these VMs is at a premium.

Did I miss something?

chef-rbenv and chef standard package

Hello Guys,

currently I have the problem that I'd like to install passenger with the passenger_apache2 recipe. This recipe comes after the chef-rbenv recipe in my run_list. The problem now is that the passenger_apache2 recipe is using the standard 'package' resource to install gems... which install the passenger gem with the system ruby... Is there a smart way to make the standard 'package' aware of rbenv without modifying the passenger_apache2 recipe or rolling my own?

Speeding up builds of new Ruby versions

Hi there --

I'm looking into speeding up my builds of ruby on new machines when using chef-rbenv, for some specific time sensitive builds when I need extra capacity. I'd like to get some sort of binary tarball I can drop on systems, before bootstrapping a chef-client, so that I'm not waiting for an actual compilation of ruby.

I noticed here is where the actual rbenv install command is defined in chef-rbenv:
https://github.com/fnichol/chef-rbenv/blob/master/providers/ruby.rb#L61

It seems like I could probably supply RUBY_BUILD_BUILD_PATH or RUBY_BUILD_CACHE_PATH and prepopulate one of them, as described by:
https://github.com/sstephenson/ruby-build#special-environment-variables

Alternately, I could just tar up the entire rbenv directory, bring it over to a new host, just ensure the environment (PATH, bash completions, etc) is configured right. Do you think that's the best way to do this, so that initial chef bootstraps aren't slower, but I could still use the regular process when I'm not in a hurry for capacity?

Just looking for your thoughts here -- I'd value them greatly!

Thanks,
@martinb3

Crash when passing hash to "rubies" param

This is my config:

 :rbenv => {
        :user_installs => [{
          :user => 'jenkins',
          :rubies => [ "1.9.3-p429", "2.0.0-p195", "jruby-1.7.4", { 'name' => "ree-1.8.7-2012.02", 'environment' => { 'CONFIGURE_OPTS' => '--no-tcmalloc' } } ],
          :vagrant => { 'system_chef_solo' => '/opt/chef/bin/chef-solo'},
          :gems => {
            "1.9.3-p429" => [{ 'name' => 'bundler' }, { 'name' => 'rake' }],
            "2.0.0-p195" => [{ 'name' => 'bundler' } ], #2.0.0 ships with rake
            "jruby-1.7.4" => [{ 'name' => 'bundler' }, { 'name' => 'rake' }],
            "ree-1.8.7-2012.02" => [{ 'name' => 'bundler' }, { 'name' => 'rake' }],
          }
        }],
      },

Apparently I am allowed to pass in a hash for a ruby definition ("if rubie.is_a?(Hash)"), but it will crash in the "definition" step because that one doesn't accept a Hash

================================================================================
Recipe Compile Error in /tmp/vagrant-chef-1/chef-solo-2/cookbooks/rbenv/recipes/user.rb
================================================================================


Chef::Exceptions::ValidationFailed
----------------------------------
Option definition must be a kind of String!  You passed {"name"=>"ree-1.8.7-2012.02", "environment"=>{"CONFIGURE_OPTS"=>"--no-tcmalloc"}}.


Cookbook Trace:
---------------
  /tmp/vagrant-chef-1/chef-solo-2/cookbooks/rbenv/recipes/user.rb:29:in `block (3 levels) in from_file'
  /tmp/vagrant-chef-1/chef-solo-2/cookbooks/rbenv/recipes/user.rb:28:in `block (2 levels) in from_file'
  /tmp/vagrant-chef-1/chef-solo-2/cookbooks/rbenv/recipes/user.rb:26:in `each'
  /tmp/vagrant-chef-1/chef-solo-2/cookbooks/rbenv/recipes/user.rb:26:in `block in from_file'
  /tmp/vagrant-chef-1/chef-solo-2/cookbooks/rbenv/recipes/user.rb:22:in `each'
  /tmp/vagrant-chef-1/chef-solo-2/cookbooks/rbenv/recipes/user.rb:22:in `from_file'


Relevant File Content:
----------------------
/tmp/vagrant-chef-1/chef-solo-2/cookbooks/rbenv/recipes/user.rb:

 22:  Array(node['rbenv']['user_installs']).each do |rbenv_user|
 23:    rubies    = rbenv_user['rubies'] || node['rbenv']['user_rubies']
 24:    gem_hash  = rbenv_user['gems'] || node['rbenv']['user_gems']
 25:  
 26:    rubies.each do |rubie|
 27:      if rubie.is_a?(Hash)
 28:        rbenv_ruby "#{rubie} (#{rbenv_user['user']})" do
 29>>         definition  rubie
 30:          user        rbenv_user['user']
 31:          root_path   rbenv_user['root_path'] if rbenv_user['root_path']
 32:          environment rubie['environment'] if rubie['environment']
 33:        end
 34:      else
 35:        rbenv_ruby "#{rubie} (#{rbenv_user['user']})" do
 36:          definition  rubie
 37:          user        rbenv_user['user']
 38:          root_path   rbenv_user['root_path'] if rbenv_user['root_path']

Source rbenv.sh template after installing it

After rbenv is installed, it should be initialized to be used in the current provisioning.
In my case, I wanted to prepare my rails environment in vagrant, but my rbenv settings aren't applied at the first run of chef-solo.

Provider Check for ruby_build doesn't understand dependencies

The ruby provider makes a check:

def ruby_build_missing?
  ! node.recipe?("ruby_build")
end

This doesn't work in the case where ruby_build will be present because of a depends in a cookbook on the run list. For example, a workstation cookbook which uses the rbenv::system recipe, with a default Ruby set, and a depends on both rbenv and ruby_build in the metadata.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.