Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

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 · 16 comments · Fixed by #134
Closed

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

leomao10 opened this issue Aug 28, 2012 · 16 comments · Fixed by #134

Comments

@leomao10
Copy link

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 :)

@leonid-shevtsov
Copy link

Seconded.

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

@kouno
Copy link

kouno commented Sep 23, 2012

+1. My google researches actually brought me here.

@hgilani
Copy link

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?

@brandonparsons
Copy link

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

@fnichol
Copy link
Contributor

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 as completed Nov 12, 2012
@volkanunsal
Copy link

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

@pangratz
Copy link

@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

@volkanunsal
Copy link

That worked. Thanks!

On Thu, Nov 15, 2012 at 11:47 AM, Clemens Müller
[email protected]:

@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//issues/121#issuecomment-10415472.

@mulderp
Copy link

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
Copy link

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.

@mdpatrick
Copy link

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

@mulderp
Copy link

mulderp commented Dec 16, 2013

Interesting, thanks for the notice

h0ngcha0 pushed a commit to h0ngcha0/rvm-cookbook that referenced this issue Feb 16, 2014
@kowal
Copy link

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
Copy link

kowal commented Jul 21, 2014

@fnichol can we reopen this?

@ChrisPetr0
Copy link

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

@lock
Copy link

lock bot commented Apr 25, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.