Coder Social home page Coder Social logo

Comments (15)

miah avatar miah commented on July 24, 2024

chef.rb

include_recipe "rvm::system"

rvm_default_ruby "ruby-1.9.2-p290@chef-rundeck" do
user node[:rundeck][:user]
action :create
end

rvm_gem "chef-rundeck" do
user node[:rundeck][:user]
ruby_string "ruby-1.9.2-p290@chef-rundeck"
source "RubyGems"
action :upgrade
end

from rvm.

miah avatar miah commented on July 24, 2024

I think I included the wrong recipe (rvm::system), but even without that, or with user instead I get the same error. Thanks!

from rvm.

fnichol avatar fnichol commented on July 24, 2024

Ok, I think I get this now. If you want RVM to be installed for the node[:rundeck][:user] (and not installed as root system-wide), then you would want to include the rvm::user_install recipe which only installs the RVM framework. You'd also need to ensure that the node[:rundeck][:user] user has already been created.

Do you have any better luck with this:

# chef.rb

include_recipe "rvm::user_install"

rvm_default_ruby "ruby-1.9.2-p290@chef-rundeck" do
  user node[:rundeck][:user]
end

rvm_gem "chef-rundeck" do
  user node[:rundeck][:user]
  ruby_string "ruby-1.9.2-p290@chef-rundeck"
  action :upgrade
end

from rvm.

miah avatar miah commented on July 24, 2024

Hrm. No go. :( I made my little recipe look exactly like what you have above and here is the result. Do I need to update my chef-rvm cookbook maybe?

ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:08 +0000] INFO: Processing service[rundeckd] action enable (rundeck::server line 80)
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:08 +0000] INFO: Processing gem_package[rvm] action nothing (rvm::default line 21)
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:08 +0000] INFO: Processing package[sed] action install (rvm::user_install line 44)
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:08 +0000] INFO: Processing package[grep] action install (rvm::user_install line 44)
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] INFO: Processing package[tar] action install (rvm::user_install line 44)
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] INFO: Processing package[gzip] action install (rvm::user_install line 44)
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] INFO: Processing package[bzip2] action install (rvm::user_install line 44)
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] INFO: Processing package[bash] action install (rvm::user_install line 44)
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] INFO: Processing package[curl] action install (rvm::user_install line 44)
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] INFO: Processing package[git-core] action install (rvm::user_install line 44)
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] INFO: Processing template[/home/rundeck/.rvmrc] action create (rvm::user_install line 135)
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] INFO: template[/home/rundeck/.rvmrc] owner changed to 6100
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] INFO: template[/home/rundeck/.rvmrc] mode changed to 644
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] ERROR: template[/home/rundeck/.rvmrc](rvm::user_install line 135) has had an error
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] ERROR: template[/home/rundeck/.rvmrc](/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:135:in rvmrc_template') had an error: ec2-50-19-147-92.compute-1.amazonaws.com template[/home/rundeck/.rvmrc](rvm::user_install line 135) had an error: No such file or directory - /tmp/chef-rendered-template20111126-706-1hg2xwy-0 or /home/rundeck/.rvmrc ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/1.8/fileutils.rb:506:in rename'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/1.8/fileutils.rb:506:inmv' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/1.8/fileutils.rb:1397:in fu_each_src_dest'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/1.8/fileutils.rb:1413:infu_each_src_dest0' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/1.8/fileutils.rb:1395:in fu_each_src_dest'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/1.8/fileutils.rb:495:inmv' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/provider/template.rb:47:in action_create'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/mixin/template.rb:48:inrender_template' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/1.8/tempfile.rb:188:in open'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/mixin/template.rb:45:inrender_template' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/provider/template.rb:99:in render_with_context'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/provider/template.rb:39:inaction_create' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:437:in send'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:437:inrun_action' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:45:in run_action'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:inconverge' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:in each'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:inconverge' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:94:in execute_each_resource'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:incall' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in call_iterator_block'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:instep' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in iterate'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:ineach_with_index' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:92:in execute_each_resource'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:76:inconverge' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/client.rb:312:in converge'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/client.rb:160:inrun' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:239:in run_application'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:inloop' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in run_application'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application.rb:67:inrun' ec2-50-19-147-92.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-client:26 ec2-50-19-147-92.compute-1.amazonaws.com /usr/bin/chef-client:19:in load'
ec2-50-19-147-92.compute-1.amazonaws.com /usr/bin/chef-client:19
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:09 +0000] ERROR: Running exception handlers
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:11 +0000] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:11 +0000] ERROR: Exception handlers complete
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:11 +0000] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
ec2-50-19-147-92.compute-1.amazonaws.com [Sat, 26 Nov 2011 21:35:11 +0000] FATAL: Errno::ENOENT: template[/home/rundeck/.rvmrc](rvm::user_install line 135) had an error: No such file or directory - /tmp/chef-rendered-template20111126-706-1hg2xwy-0 or /home/rundeck/.rvmrc

from rvm.

miah avatar miah commented on July 24, 2024

Hrm. I realized I had some overrides set in my rundeck role. So I removed all that. My rundeck role just calls rundeck::chef after rundeck. rundeck::chef contains the recipe we're talking about here. So Now I'm back to this error...

ec2-107-22-88-59.compute-1.amazonaws.com [Sat, 26 Nov 2011 22:23:05 +0000] INFO: Processing rvm_environment[ruby-1.9.2-p290@rundeck] action create (rundeck::chef line 21)
ec2-107-22-88-59.compute-1.amazonaws.com [Sat, 26 Nov 2011 22:23:05 +0000] ERROR: rvm_environment[ruby-1.9.2-p290@rundeck](rundeck::chef line 21) has had an error
ec2-107-22-88-59.compute-1.amazonaws.com [Sat, 26 Nov 2011 22:23:05 +0000] ERROR: rvm_environment[ruby-1.9.2-p290@rundeck](/var/chef/cache/cookbooks/rundeck/recipes/chef.rb:21:in from_file') had an error: ec2-107-22-88-59.compute-1.amazonaws.com rvm_environment[ruby-1.9.2-p290@rundeck](rundeck::chef line 21) had an error: private method chomp' called for nil:NilClass
ec2-107-22-88-59.compute-1.amazonaws.com /var/chef/cache/cookbooks/rvm/libraries/chef_rvm_string_cache.rb:77:incanonical_ruby_string' ec2-107-22-88-59.compute-1.amazonaws.com /var/chef/cache/cookbooks/rvm/libraries/chef_rvm_string_cache.rb:50:in fetch'
ec2-107-22-88-59.compute-1.amazonaws.com /var/chef/cache/cookbooks/rvm/libraries/chef_rvm_string_helpers.rb:55:innormalize_ruby_string' ec2-107-22-88-59.compute-1.amazonaws.com /var/chef/cache/cookbooks/rvm/providers/environment.rb:27:in load_current_resource'
ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:436:inrun_action' ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:45:in run_action'
ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:inconverge' ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:in each'
ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:inconverge' ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:94:in execute_each_resource'
ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:incall' ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in call_iterator_block'
ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:instep' ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in iterate'
ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:ineach_with_index' ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:92:in execute_each_resource'
ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:76:inconverge' ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/client.rb:312:in converge'
ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/client.rb:160:inrun' ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:239:in run_application'
ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:inloop' ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in run_application'
ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application.rb:67:inrun' ec2-107-22-88-59.compute-1.amazonaws.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-client:26 ec2-107-22-88-59.compute-1.amazonaws.com /usr/bin/chef-client:19:in load'
ec2-107-22-88-59.compute-1.amazonaws.com /usr/bin/chef-client:19
ec2-107-22-88-59.compute-1.amazonaws.com [Sat, 26 Nov 2011 22:23:05 +0000] ERROR: Running exception handlers
ec2-107-22-88-59.compute-1.amazonaws.com [Sat, 26 Nov 2011 22:23:07 +0000] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
ec2-107-22-88-59.compute-1.amazonaws.com [Sat, 26 Nov 2011 22:23:07 +0000] ERROR: Exception handlers complete
ec2-107-22-88-59.compute-1.amazonaws.com [Sat, 26 Nov 2011 22:23:07 +0000] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
ec2-107-22-88-59.compute-1.amazonaws.com [Sat, 26 Nov 2011 22:23:07 +0000] FATAL: NoMethodError: rvm_environment[ruby-1.9.2-p290@rundeck] (rundeck::chef line 21) had an error: private method`chomp' called for nil:NilClass

from rvm.

jgrevich avatar jgrevich commented on July 24, 2024

I ran into this issue/error as well and tracked it down to the default installer URL (or using an outdated version of the recipe). Try updating the recipe from git or overriding the installer_url to "http://get.rvm.io".

Please close the issue if that was the problem.

from rvm.

fnichol avatar fnichol commented on July 24, 2024

Ah, that's great to know, thanks @jgrevich!

from rvm.

fnichol avatar fnichol commented on July 24, 2024

I think we're good here, and I'll bug @miah at ChefConf if there's still any nagging issues.

from rvm.

jeremyolliver avatar jeremyolliver commented on July 24, 2024

This seems to be the error message encountered whenever the install rvm script fails (which from what I can see the actual download is here https://github.com/fnichol/chef-rvm/blob/master/libraries/chef_rvm_recipe_helpers.rb#L78)

I'm using chef behind an http proxy, and this seems to be causing the download to fail. If I run the curl manually, it goes through fine as I've got http_proxy setup as a variable in the shell environment (via /etc/environment) though I think this download doesn't load in the shell environment (or check if chef is configured to do so either), this can fail.

Support for http_proxy would be nice, but even failing that, I think there should really be an indication that there was an error in the download or installation before the script gets to this point, it's a bit of a misleading error message.

from rvm.

brax4444 avatar brax4444 commented on July 24, 2024

On Chef 10.12.0:
[2012-08-21T23:44:43+00:00] FATAL: NoMethodError: rvm_default_ruby[ruby-1.9.3-p194@katipo](app-katipo::default line 42) had an error: NoMethodError: private method `chomp' called for nil:NilClass

default line 42:
rvm_default_ruby 'ruby-1.9.3-p194@katipo' do

I verified my installer URL is correct. Another troubleshooting suggestion?

from rvm.

2-718 avatar 2-718 commented on July 24, 2024

Problem resolved:

Using chef-rvm (git commit 6411f11), Chef 10.14.2, vagrant 1.0.5, CentOS 5.6 (minimalcentos56)

I had the same NoMethodError as above and found two contributing causes:

  • my CentOS 5.6 CA certificates were too old, causing curl to abort the HTTPS connection
  • the install_rvm method (chef_rvm_recipe_helpers.rb) lacks permission to create /usr/local/rvm

I fixed the first issue by adding the following to my default recipe:

remote_file '/etc/pki/tls/certs/ca-bundle.crt' do
  Chef::Log.info 'Updating CA certificates'
  source  'http://curl.haxx.se/ca/cacert.pem'
  owner   'root'
  group   'root'
  mode    '0644'
end

The second issue was fixed by changing line 78 of cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:

Before:

command "curl -L #{opts[:installer_url]} | bash #{opts[:script_flags]}"

After:

command "curl -L #{opts[:installer_url]} | sudo bash #{opts[:script_flags]}"

I'm not familiar enough with Chef to know whether there's a more effective way to update the CA certificates, nor whether chef-rvm can provide better diagnostics to pinpoint the source of the failure.

Also, I don't like inserting sudo into the bash command because I don't think it will do the right thing when installing a user RVM (I'm using the system-wide installation).

from rvm.

cromulus avatar cromulus commented on July 24, 2024

For those of you showing up here because the get.rvm.io ssl certificate has expired, you can, in the short run (untill they fix the certificate) add this to your config:

node['rvm']['installer_url']="https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer"

from rvm.

phumpal avatar phumpal commented on July 24, 2024

Thanks @cromulus - saved the day.

from rvm.

Xorelock avatar Xorelock commented on July 24, 2024

I'm running into the same problem as @jeremyolliver . Can you add support for http_proxy and https_proxy?

from rvm.

lock avatar lock commented on July 24, 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.