Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Default RVM Ruby #14

Closed
yfeldblum opened this issue Apr 30, 2011 · 6 comments
Closed

No Default RVM Ruby #14

yfeldblum opened this issue Apr 30, 2011 · 6 comments
Assignees
Labels
Bug Something isn't working

Comments

@yfeldblum
Copy link

Provide an easy way to disable having a default RVM Ruby while keeping the system Ruby as the default.

Currently, I have to:

node.override.rvm.delete("default_ruby")
node.override.rvm.install_rubies = "disable" # or I get an error

before:

include_recipe "rvm"
node.rvm.rubies.each do |rubie|
  rvm_ruby rubie
end
# because the rvm rubies otherwise won't get installed
# should also do the same thing with global gems
@yfeldblum
Copy link
Author

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.

@fnichol
Copy link
Contributor

fnichol commented May 1, 2011

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!

@fnichol
Copy link
Contributor

fnichol commented May 1, 2011

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.

@ghost ghost assigned fnichol May 1, 2011
@yfeldblum
Copy link
Author

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".

@fnichol fnichol closed this as completed in b17045b May 2, 2011
@fnichol
Copy link
Contributor

fnichol commented May 2, 2011

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!

@lock
Copy link

lock bot commented Apr 25, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants