rvm / rvm1-ansible

The official ansible RVM role to install and manage your Ruby versions.
MIT License
271 stars 136 forks source link

Error (wrong wrapper dir) while trying to install bundler after Ruby 2.2.2 #49

Closed jinhianlee closed 9 years ago

jinhianlee commented 9 years ago

Hi,

I've encountered an error when the script tries to install bundler after installing Ruby 2.2.2 - its trying to run gem commands from a missing directory: /home/vagrant/.rvm/wrappers/2.2.2/

The correct directory appears to be /home/vagrant/.rvm/wrappers/ruby-2.2.2/

Platform: fresh install of Ubuntu 14.04 on a VirtualBox VM using Vagrant on an OS X host.

The role config is:

- role: rvm_io.rvm1-ruby
          rvm1_install_flags: '--auto-dotfiles --user-install'
          rvm1_install_path: '/home/{{ ansible_ssh_user }}/.rvm'
          rvm1_rvm_version: 'stable'
          rvm1_rvm_check_for_updates: True
          rvm1_user: vagrant
          rvm1_rubies:
              - '2.2.2'
          sudo: True

Here's the full error output (vvv):

==> default: TASK: [rvm_io.rvm1-ruby | Install bundler if not installed] ******************* 
==> default: <127.0.0.1> REMOTE_MODULE command creates=/home/vagrant/.rvm/wrappers/2.2.2/bundler /home/vagrant/.rvm/wrappers/2.2.2/gem list | if ! grep "^bundler " ; then /home/vagrant/.rvm/wrappers/2.2.2/gem install bundler ; fi #USE_SHELL
==> default: <127.0.0.1> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126 && echo $HOME/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126']
==> default: <127.0.0.1> PUT /tmp/tmp3hKVvO TO /root/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126/command
==> default: <127.0.0.1> EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=ccoaibhpfmqqlhuzmhxhvgnmmyvvzrqh] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-ccoaibhpfmqqlhuzmhxhvgnmmyvvzrqh; LANG=C LC_CTYPE=C /usr/bin/python /root/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126/command; rm -rf /root/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126/ >/dev/null 2>&1'"'"''
==> default: failed: [127.0.0.1] => (item=2.2.2) => {"changed": false, "cmd": "/home/vagrant/.rvm/wrappers/2.2.2/gem list | if ! grep \"^bundler \" ; then /home/vagrant/.rvm/wrappers/2.2.2/gem install bundler ; fi", "delta": "0:00:00.007698", "end": "2015-06-13 10:52:37.563563", "item": "2.2.2", "rc": 127, "start": "2015-06-13 10:52:37.555865", "stdout_lines": [], "warnings": []}
==> default: stderr: /bin/sh: 1: /home/vagrant/.rvm/wrappers/2.2.2/gem: not found
==> default: /bin/sh: 1: /home/vagrant/.rvm/wrappers/2.2.2/gem: not found

Also including a prior error in case it's relevant (though Ruby 2.2.2 appears to have be successfully installed):

TASK: [rvm_io.rvm1-ruby | Install rubies] ************************************* 
changed: [127.0.0.1] => (item={'cmd': ['~/.rvm/bin/rvm', '2.2.2', 'do', 'true'], 'end': '2015-06-13 07:57:36.806564', 'stderr': 'ruby-2.1.2 is not installed.\nRuby ruby-2.2.2 is not installed.', 'stdout': "To install do: 'rvm install ruby-2.1.2'", 'item': '2.2.2', 'changed': False, 'rc': 2, 'failed': False, 'warnings': [], 'delta': '0:00:00.539307', 'invocation': {'module_name': u'command', 'module_args': u'~/.rvm/bin/rvm 2.2.2 do true'}, 'stdout_lines': ["To install do: 'rvm install ruby-2.1.2'"], 'failed_when_result': False, 'start': '2015-06-13 07:57:36.267257'})
gonfva commented 9 years ago

Probably related to #46. I faced a similar issue. In my case I had set up rvm1_install_path to /usr/local/rvm but rubies and gems had end up under /usr/local/lib/rvm. So I changed rvm1_install_path to the second path and things worked. It is as if when installing rvm all the paths ended up messed up.

jinhianlee commented 9 years ago

Actually, as it turned out, this is my bad - I was using the rvm short hand ('rvm install 2.2.2'), but the correct way to specify the ruby version is the full name: rvm1_rubies:

Because I was bootstrapping a VM via Vagrant's shell provisioner which runs as root, there was some additional confusion because paths did not resolve as I expected.

Closing this now.