Coder Social home page Coder Social logo

Comments (10)

fnichol avatar fnichol commented on July 24, 2024

Right off the top of my head that looks correct. Let me do a quick setup with vagrant to reproduce, there could be some deep down system-wide dependency that I didn't squash. What OS are you working with?

from rvm.

petitbon avatar petitbon commented on July 24, 2024

ubuntu 10.04

from rvm.

sadowski avatar sadowski commented on July 24, 2024

I'm having this same problem on Ubuntu 11.04.

In the defaults, default['rvm']['root_path'] is set to "/usr/local/rvm". When the update_global_gems_file method is called in the global_gem provider it does not check to see if this directory exists before trying to write into it.

Should we need to manually create that directory ourselves? What is the correct thing to do in this situation?

Here's the chef-client output with stack trace for your convenience:

[Fri, 30 Sep 2011 20:36:11 +0000] INFO: Processing template[/etc/rvmrc] action create (rvm::user_install line 135)
[Fri, 30 Sep 2011 20:36:11 +0000] INFO: template[/etc/rvmrc] backed up to /var/chef/backup/etc/rvmrc.chef-20110930203611
[Fri, 30 Sep 2011 20:36:11 +0000] INFO: template[/etc/rvmrc] mode changed to 644
[Fri, 30 Sep 2011 20:36:11 +0000] INFO: template[/etc/rvmrc] updated content
[Fri, 30 Sep 2011 20:36:11 +0000] INFO: Processing execute[install system-wide RVM] action run (rvm::user_install line 69)
[Fri, 30 Sep 2011 20:36:11 +0000] INFO: Processing execute[upgrade system-wide RVM to none] action run (rvm::user_install line 105)
[Fri, 30 Sep 2011 20:36:11 +0000] INFO: Processing rvm_default_ruby[ruby-1.8.7-p352] action create (rvm::user line 163)
[Fri, 30 Sep 2011 20:36:12 +0000] INFO: Processing rvm_global_gem[bundler] action install (rvm::user line 169)
[Fri, 30 Sep 2011 20:36:12 +0000] INFO: Processing execute[Add bundler to /usr/local/rvm/gemsets/global.gems] action run (/var/chef/cache/cookbooks/rvm/providers/global_gem.rb line 102)
[Fri, 30 Sep 2011 20:36:12 +0000] ERROR: execute[Add bundler to /usr/local/rvm/gemsets/global.gems] (/var/chef/cache/cookbooks/rvm/providers/global_gem.rb line 102) has had an error
[Fri, 30 Sep 2011 20:36:12 +0000] ERROR: rvm_global_gem[bundler] (rvm::user line 169) has had an error
[Fri, 30 Sep 2011 20:36:12 +0000] ERROR: rvm_global_gem[bundler] (/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:169:in `install_rubies') had an error:
rvm_global_gem[bundler] (rvm::user line 169) had an error: execute[Add bundler to /usr/local/rvm/gemsets/global.gems] (/var/chef/cache/cookbooks/rvm/providers/global_gem.rb line 102) had an error: Expected process to exit with [0], but received '2'
---- Begin output of echo "bundler" >> "/usr/local/rvm/gemsets/global.gems" ----
STDOUT: 
STDERR: sh: cannot create /usr/local/rvm/gemsets/global.gems: Directory nonexistent
---- End output of echo "bundler" >> "/usr/local/rvm/gemsets/global.gems" ----
Ran echo "bundler" >> "/usr/local/rvm/gemsets/global.gems" returned 2
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/shell_out.rb:207:in `invalid!'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/shell_out.rb:193:in `error!'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/mixin/shell_out.rb:36:in `shell_out!'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/provider/execute.rb:58:in `action_run'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:437:in `send'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:437:in `run_action'
/var/chef/cache/cookbooks/rvm/providers/global_gem.rb:117:in `update_global_gems_file'
/var/chef/cache/cookbooks/rvm/providers/global_gem.rb:30:in `class_from_file'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/provider.rb:104:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/provider.rb:104:in `action_install'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:437:in `send'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:437:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:45:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:in `each'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:94
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:92:in `execute_each_resource'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:76:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/client.rb:312:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/client.rb:160:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:239:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in `loop'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application.rb:67:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-client:26
/usr/bin/chef-client:19:in `load'
/usr/bin/chef-client:19
[Fri, 30 Sep 2011 20:36:12 +0000] ERROR: Running exception handlers
[Fri, 30 Sep 2011 20:36:12 +0000] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
[Fri, 30 Sep 2011 20:36:12 +0000] ERROR: Exception handlers complete
[Fri, 30 Sep 2011 20:36:12 +0000] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[Fri, 30 Sep 2011 20:36:12 +0000] FATAL: Chef::Exceptions::ShellCommandFailed: rvm_global_gem[bundler] (rvm::user line 169) had an error: execute[Add bundler to /usr/local/rvm/gemsets/global.gems] (/var/chef/cache/cookbooks/rvm/providers/global_gem.rb line 102) had an error: Expected process to exit with [0], but received '2'
---- Begin output of echo "bundler" >> "/usr/local/rvm/gemsets/global.gems" ----
STDOUT: 
STDERR: sh: cannot create /usr/local/rvm/gemsets/global.gems: Directory nonexistent
---- End output of echo "bundler" >> "/usr/local/rvm/gemsets/global.gems" ----
Ran echo "bundler" >> "/usr/local/rvm/gemsets/global.gems" returned 2

from rvm.

sadowski avatar sadowski commented on July 24, 2024

One more quick note: manually creating that directory with
sudo mkdir -p /usr/local/rvm/gemsets
solved the problem.

from rvm.

sadowski avatar sadowski commented on July 24, 2024

I created a patch for this issue here: #41

from rvm.

fnichol avatar fnichol commented on July 24, 2024

Ugh, this is totally a documentation error! @petitbon can you try this tweak:

include_recipe "rvm::user"

node['rvm']['user_installs'] = [
  { 'user' => 'hugo',
    'default_ruby'  => 'ruby-1.9.2-p290', 
    'rubies'        => ['1.9.2'],
    'rvmrc'         => {
      'rvm_project_rvmrc'             => 1,
      'rvm_gemset_create_on_use_flag' => 1,
      'rvm_pretty_print_flag'         => 1
    },

    'global_gems'   => []
  }
]

node['rvm']['user_global_gems'] = [
  { 'name'    => 'bundler',
    'version' => '1.0.17'
  },
  { 'name'    => 'rake',
    'version' => '0.9.2'
  }
]

I had intended node['rvm']['user_installs'] to be an array of hashes (each hash representing a user install), but it looks like the README gives this Array/Hash hybrid in the example usage.

@sadowski, it looks like when following the (incorrect) README formated metadata gets used the user isn't found in recipe[user] so the installation is half reverted back to a system-wide install (hence the error about requiring a system-wide directory). If you're able to test your Vagrantfile/metadata to confirm I should be able to close off your pull request.

Apologies to all!

from rvm.

sadowski avatar sadowski commented on July 24, 2024

I agree that a user install shouldn't need to create any system directories, so feel free to close off my pull request.

However, I don't think it should try to do a system-wide install if a user install is requested. It's probably better to just fail gracefully at that point. Maybe check the required parameters of the node['rvm']['user_installs'] before starting and raise an error if it looks wrong?

Thanks!

from rvm.

fnichol avatar fnichol commented on July 24, 2024

@sadowski I totally agree about the unnecessary system-wide install. The default behavior of all the LWRPs is to assume system-wide when a user attribute is not passed in. When the (improperly formatted) metadata hash was being parsed, no user key was found leading to a blank attribute value for user in the rvm_environment LWRP. This could be something I could guard against in the user/user_install recipes, but you're correct: the user installs should never touch files and directories outside a user's home directory. That way you could run user recipes as a non-root user (I do this to setup my mac workstations)

from rvm.

fnichol avatar fnichol commented on July 24, 2024

I think we've beat this one into submissions, thanks to all for your feedback.

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.