test-kitchen / test-kitchen

Test Kitchen is an integration tool for developing and testing infrastructure code and software on isolated target platforms
Other
1.87k stars 586 forks source link

Test kitchen fails to install busser properly when system-level rvm installed ruby exists #200

Closed eklein closed 10 years ago

eklein commented 11 years ago

When trying to run a kitchen verify against an image that has a system-level rvm installed ruby, busser install fails. As best I can tell, this is because rvm gets in the way of the gem install, forcing busser to be installed in the rvm installed ruby no matter what. Test-kitchen then attempts to look for busser in the default locations (/opt/chef/embedded/...) and fails.

This is using test-kitchen 1.0.0.beta.3 after including 'chef-rvm::system' in the runlist.

Output of failed kitchen verify:

-----> Starting Kitchen (v1.0.0.beta.3)
-----> Setting up <default-centos-64-x86-64>
Fetching: thor-0.18.1.gem (100%)
Fetching: busser-0.4.1.gem (100%)
       Successfully installed thor-0.18.1
       Successfully installed busser-0.4.1
       2 gems installed
       sudo: /opt/chef/embedded/bin/busser: command not found
       sudo: /opt/busser/bin/busser: command not found
>>>>>> Setup failed on instance <default-centos-64-x86-64>.
>>>>>> Please see .kitchen/logs/default-centos-64-x86-64.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [bash -c '
if ! sudo -E /opt/chef/embedded/bin/gem list busser -i >/dev/null ; then
  sudo -E /opt/chef/embedded/bin/gem install busser --no-rdoc --no-ri
fi
sudo -E /opt/chef/embedded/bin/busser setup
sudo -E /opt/busser/bin/busser plugin install busser-serverspec'
]
>>>>>> ----------------------

Despite the fact that /opt/chef/embedded/bin/gem install busser is being called explicitly, busser is installed in the rvm system ruby. If you login to the system, here's what you have:

[vagrant@default-centos-64-x86-64 ~]$ ls -l /opt/chef/embedded/lib/ruby/gems/1.9.1/gems
total 92
drwxr-xr-x  6 root root 4096 Apr 23 23:34 bundler-1.1.5
drwxr-xr-x  7 root root 4096 Apr 23 23:34 chef-11.4.4
drwxr-xr-x 10 root root 4096 Apr 23 23:34 erubis-2.7.0
drwxr-xr-x  7 root root 4096 Apr 23 23:34 highline-1.6.18
drwxr-xr-x  4 root root 4096 Apr 23 23:34 ipaddress-0.8.0
drwxr-xr-x  5 root root 4096 Apr 23 23:34 mime-types-1.23
drwxr-xr-x  4 root root 4096 Apr 23 23:34 mixlib-authentication-1.3.0
drwxr-xr-x  4 root root 4096 Apr 23 23:34 mixlib-cli-1.3.0
drwxr-xr-x  5 root root 4096 Apr 23 23:34 mixlib-config-1.1.2
drwxr-xr-x  4 root root 4096 Apr 23 23:34 mixlib-log-1.6.0
drwxr-xr-x  3 root root 4096 Apr 23 23:34 mixlib-shellout-1.1.0
drwxr-xr-x  5 root root 4096 Apr 23 23:34 net-ssh-2.6.7
drwxr-xr-x  4 root root 4096 Apr 23 23:34 net-ssh-gateway-1.2.0
drwxr-xr-x  4 root root 4096 Apr 23 23:34 net-ssh-multi-1.1
drwxr-xr-x  4 root root 4096 Apr 23 23:34 net-ssh-multi-1.2.0
drwxr-xr-x  6 root root 4096 Apr 23 23:34 ohai-6.16.0
drwxr-xr-x  3 root root 4096 Apr 23 23:34 rake-0.9.2.2
drwxr-xr-x  3 root root 4096 Apr 23 23:34 rdoc-3.9.4
drwxr-xr-x  5 root root 4096 Apr 23 23:34 rest-client-1.6.7
drwxr-xr-x  3 root root 4096 Apr 23 23:34 ruby-shadow-2.2.0
drwxr-xr-x  4 root root 4096 Sep 16 21:19 rvm-1.11.3.8
drwxr-xr-x  5 root root 4096 Apr 23 23:34 systemu-2.5.2
drwxr-xr-x  8 root root 4096 Apr 23 23:34 yajl-ruby-1.1.0

As a result, when test-kitchen looks for busser in /opt/chef/embedded/bin, it fails.

If you remove the system-level rvm installed ruby, kitchen verify succeeds.

Please let me know if any additional information would be helpful.

eklein commented 11 years ago

Oops, additionally, here's where you find busser on that system:

[vagrant@default-centos-64-x86-64 ~]$ which busser
/usr/local/rvm/gems/ruby-1.9.3-p327/bin/busser
sethvargo commented 10 years ago

Thank you for the report. We believe this has been fixed as a result of 16fb8c29ca.

eklein commented 10 years ago

Nice, thank you!!