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

Already on GitHub? Sign in to your account

change default ruby_path to /opt/vagrant_ruby/bin/chef-solo if use vagrant #121

Closed
leomao10 opened this Issue Aug 28, 2012 · 15 comments

Comments

Projects
None yet

Hi @fnichol,

I am currently trying vagrant with chef.

This is my Vagrantfile:

Vagrant::Config.run do |config|
  # All Vagrant configuration is done here. The most common configuration
  # options are documented and commented below. For a complete reference,
  # please see the online documentation at vagrantup.com.

  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "sandbox"

  # The url from where the 'config.vm.box' box will be fetched if it
  # doesn't already exist on the user's system.
  config.vm.box_url = "http://files.vagrantup.com/precise64.box"
    config.vm.provision :chef_solo do |chef|
    chef.add_recipe "apt"
    chef.add_recipe "postgresql::client"
    chef.add_recipe "rvm::vagrant"
    chef.add_recipe "rvm::system"
  end
end

After I go vagrant up, I could not use chef-solo anymore. After couple hours google, I found that I actually need to add this code :

chef.json = {
      'rvm' => {
        'vagrant' => {
          'system_chef_solo' => '/opt/vagrant_ruby/bin/chef-solo'
        }
      }
    }

And it works fine now. But since vagrant is using /opt/vagrant_ruby/bin as default ruby_path, do you think it is better to use this path if I add recipe rvm::vagrant?

BTW, Nice work for the chef-rvm, really like it :)

Seconded.

A more robust solution is to determine the path to the current chef-solo executable when installing RVM, and symlink that.

kouno commented Sep 23, 2012

+1. My google researches actually brought me here.

hgilani commented Oct 3, 2012

+1, faced the same issue and fix suggested in issue description worked. Could this be a default attribute if rvm::vagrant recipe is used?

Wow. Gotta love google and Github. There's always people experiencing the same pain as me :)

Collaborator

fnichol commented Nov 12, 2012

Right on, thank you everyone, #134 should resolve this. I'll cut a release of the cookbook shortly.

@fnichol fnichol closed this Nov 12, 2012

Where do I put the chef.json file? On the host system? In the VM? Somewhere on the shared directory?

@tenaciousflea

The chef.json is a configuration inside the Vagrantfile, something along this lines:

config.vm.box_url = "http://files.vagrantup.com/precise64.box"
    config.vm.provision :chef_solo do |chef|
    chef.add_recipe "apt"
    chef.add_recipe "postgresql::client"
    chef.add_recipe "rvm::vagrant"
    chef.add_recipe "rvm::system"

    chef.json = {
      'rvm' => {
        'vagrant' => {
          'system_chef_solo' => '/opt/vagrant_ruby/bin/chef-solo'
        }
      }
    }
  end

That worked. Thanks!

On Thu, Nov 15, 2012 at 11:47 AM, Clemens Müller
notifications@github.comwrote:

@tenaciousflea https://github.com/tenaciousflea

The chef.json is a configuration inside the Vagrantfile, something along
this:

config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.provision :chef_solo do |chef|
chef.add_recipe "apt"
chef.add_recipe "postgresql::client"
chef.add_recipe "rvm::vagrant"
chef.add_recipe "rvm::system"

chef.json = {
  'rvm' => {
    'vagrant' => {
      'system_chef_solo' => '/opt/vagrant_ruby/bin/chef-solo'
    }
  }
}

end


Reply to this email directly or view it on GitHubhttps://github.com/fnichol/chef-rvm/issues/121#issuecomment-10415472.

mulderp commented Feb 25, 2013

Hi!
I am working on a Chef-Rails-Stack with Berkshelf, and I am seeing the same issue as discussed in this issue. My project is at https://github.com/mulderp/chef-rails-stack - and I am not seeing yet, what's wrong. Maybe someone of you sees where rvm is going wrong?

mulderp commented Feb 26, 2013

Ok, just in case, the problem is related to using the sudo cookbook together with:

http://community.opscode.com/cookbooks/sudo

When running the sudo cookbook, rvm/rbenv are in trouble in the second conversion.

@mulderp Check the diff of that pull request. That solution worked for me.

mulderp commented Dec 16, 2013

Interesting, thanks for the notice

liuhongchao pushed a commit to liuhongchao/rvm-cookbook that referenced this issue Feb 16, 2014

@kowal kowal referenced this issue in test-kitchen/test-kitchen May 12, 2014

Closed

Second converge run choses wrong chef version #436

kowal commented May 12, 2014

@fnichol I just run into this using chef-rvm 0.9.2

in recipe:

include_recipe 'rvm::user'
include_recipe 'rvm::vagrant'

in attributes.rb

node.override['rvm']['user_installs'] = [
  { 'user'          => 'vagrant',
    'default_ruby'  => 'jruby-1.7.11',
    'rubies'        => ['jruby-1.7.11'],
    'global_gems'   => [
      { 'name'    => 'bundler' },
      { 'name'    => 'rake' }
    ],
    'rvmrc' => { "rvm_autolibs_flag" => "disabled" }
  }
]

With above test-kitchen was always failing during second converge. When I added into my recipe code from @mdpatrick - https://github.com/fnichol/chef-rvm/pull/241/files - it works fine again.

So apparently rvm is still messing something with PATH.

kowal commented Jul 21, 2014

@fnichol can we reopen this?

Thanks, I had the same problem, the code in the link above (https://github.com/fnichol/chef-rvm/pull/241/files) works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment