3

I am trying to deploy rails app through chef . code deployed successfully ,but bundle install throwing error for specific gems , When installed manually gem installs without any issues , as per the chef error i got to know that , to execute bundle install chef uses its embedded ruby version and path for the same , but system is installed with ruby 2.0 using rvm .Can we override the chef ruby path to system ruby path ? I am using following code to deploy ,

 deploy_branch "master" do     
    repo repo_url    
    migrate false    
    action :deploy    
    branch 'master'    
    enable_submodules true    
    before_migrate do     
        current_release_directory = release_path    
        running_deploy_user = new_resource.user    
        bundler_depot = new_resource.shared_path + '/bundle'    
        excluded_groups = %w(development test)    
        script 'Bundling the gems' do    
            interpreter 'bash'    
            cwd current_release_directory    
            user running_deploy_user    
            code <<-EOS    
            bundle install --quiet --deployment --path #{bundler_depot} \
            --without #{excluded_groups.join(' ')}    
            EOS    
        end    
    end    
end    
mbdvg
  • 2,614
  • 3
  • 21
  • 39
  • I would use `rvm 2.0 do bundle...` in the code block as you're using rvm at first. (better use the attribute for version instead of fixed string, but as I've no idea of which attribute you're using..) – Tensibai Feb 13 '15 at 10:16
  • You could potentially use the [environment attribute](https://docs.chef.io/resource_script.html#actions) to provide a `PATH` for where bundler is located. – Arthur Maltson Feb 13 '15 at 16:49

0 Answers0