Coder Social home page Coder Social logo

No Default RVM Ruby about rvm HOT 6 CLOSED

yfeldblum avatar yfeldblum commented on August 28, 2024
No Default RVM Ruby

from rvm.

Comments (6)

yfeldblum avatar yfeldblum commented on August 28, 2024

Additionally, once I do the above and have RVM installed and RVM rubies installed but no default RVM ruby (instead continuing to use system ruby as the default)....

When I follow up and do

rvm_gem "whatever" do
  ruby_string "ruby-1.9.2-p180" # that's one of the already-installed RVM rubies
end

then, in the same initial run of the my cookbook (which makes use of your RVM cookbook), I get

ERROR: rvm_gem[whatever] (/srv/chef/cache/cookbooks/myfuncookbook/recipes/myfunrecipe.rb:1:in `from_file') had an error:
Expected process to exit 0, but it exited with 127
---- Begin output of bash -c "source /etc/profile.d/rvm.sh" && rvm ruby-1.9.2-p180 gem env gempath ----
STDOUT: 
STDERR: sh: rvm: not found
---- End output of bash -c "source /etc/profile.d/rvm.sh" && rvm ruby-1.9.2-p180 gem env gempath ----
Ran bash -c "source /etc/profile.d/rvm.sh" && rvm ruby-1.9.2-p180 gem env gempath returned 127
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/shell_out.rb:232:in `invalid!'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/shell_out.rb:218:in `error!'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/mixin/shell_out.rb:33:in `shell_out!'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/provider/package/rubygems.rb:237:in `gem_paths'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/provider/package/rubygems.rb:245:in `gem_source_index'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/provider/package/rubygems.rb:76:in `installed_versions'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/provider/package/rubygems.rb:346:in `matching_installed_versions'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/provider/package/rubygems.rb:329:in `current_version'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/provider/package/rubygems.rb:362:in `load_current_resource'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource.rb:394:in `run_action'
/srv/chef/cache/cookbooks/rvm/providers/gem.rb:109:in `gem_package_wrapper'
/srv/chef/cache/cookbooks/rvm/providers/gem.rb:40:in `class_from_file'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/provider.rb:104:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/provider.rb:104:in `action_install'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource.rb:395:in `send'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource.rb:395:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/runner.rb:53:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/runner.rb:89:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/runner.rb:89:in `each'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/runner.rb:89:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource_collection.rb:94
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource_collection.rb:92:in `execute_each_resource'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/runner.rb:84:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/client.rb:268:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/client.rb:171:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/application/client.rb:222:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/application/client.rb:212:in `loop'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/application/client.rb:212:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/../lib/chef/application.rb:62:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.16/bin/chef-client:26
/usr/bin/chef-client:19:in `load'
/usr/bin/chef-client:19

But on the second attempt to run the cookbook, the "rvm_gem[whatever]" resource succeeds (instead of failing with the above backtrace) as expected.

from rvm.

fnichol avatar fnichol commented on August 28, 2024

Ok, I see a couple of tweaks in the default recipe that I can make. Primarily, handling an empty or nil rvm/default_ruby so you don't have to additionally set rvm/install_rubies to "disable".

I'm also going to see if setting rvm/default_ruby to "system" will keep the system ruby as the default. This works on the regular CLI as far as I remember. If that ends up working, do you think a documentation clarification would help in this case?

Thanks!

from rvm.

fnichol avatar fnichol commented on August 28, 2024

Now I see what you were seeing with your initial chef run (sh: rvm: not found). Looks like it's a behavior change I made for #10, so this needs re-addressing.

from rvm.

yfeldblum avatar yfeldblum commented on August 28, 2024

The cookbook currently doesn't think that "system" is a known_ruby, and doesn't know what to do with nil or "".

The cookbook should permit nil (and optionally "" and "system") as values signifying that no default ruby should be set (and, if one is set, it should be unset).

In recipes/default.rb, there should be such a check. Alternatively, the check could be moved further up the call chain: e.g., in providers/default_ruby.rb, have an explicit check for nil, "", or "system".

from rvm.

fnichol avatar fnichol commented on August 28, 2024

This should do it. I made the rvm_default_ruby resource take ownership of recognizing an empty or "system" setting so the default recipe should work as well as the standalone resource. I also took your suggestion and now skip iteration of rvm/gems and rvm/global_gems when rvm/install_rubies is set to "disable". If you find anything, let me know. Thanks!

from rvm.

lock avatar lock commented on August 28, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from rvm.

Related Issues (20)

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.