Bundler issue when building from source


#1

Hi all,

I’m writing a Chef cookbook for the installation of ManageIQ and I’m running into an issue with the installation steps for installing manageiq from source (http://manageiq.org/community/install-from-source/). The issue I’m experiencing is with step 8 where you uninstall the newer version of the bunlder and install 1.3.5.

I’ve run into this issue in the past and I was able to get around it by just executing and the command below in chef recipe. I was wondering if anyone else who is building manageiq from source has been able to get around having to remove the latest version of the bundler or find some other way to easily implement step 8.

#####command I’m running in Chef recipe

command “gem uninstall -i /home/miqbuilder/.rvm/gems/ruby-1.9.3-p547@global bundler”

#####stack output of chef failure because of bundler version being incorrect
* rvm_gem[ruby-graphviz] action install (up to date)
* rvm_shell[miq vmdb bundle install] action run
* script[miq vmdb bundle install] action run

      ================================================================================
      Error executing action `run` on resource 'script[miq vmdb bundle install]'
      ================================================================================
      
      Mixlib::ShellOut::ShellCommandFailed
      ------------------------------------
      Expected process to exit with [0], but received '6'
      ---- Begin output of "bash"  "/tmp/chef-script20141105-13240-1de6n2l" ----
      STDOUT: Using /home/miqbuilder/.rvm/gems/ruby-1.9.3-p550
      Updating git://github.com/ManageIQ/rails.git
      Updating git://github.com/ManageIQ/fog.git
      Updating git://github.com/ManageIQ/handsoap.git
      Updating git://github.com/ManageIQ/rest-client.git
      Updating git://github.com/ManageIQ/rubywbem.git
      Updating git://github.com/ManageIQ/ruport.git
      Updating git://github.com/ManageIQ/actionwebservice.git
      Updating git://github.com/ManageIQ/ruby-net-ldap.git
      Updating git://github.com/ManageIQ/rubyrep.git
      Updating git://github.com/ManageIQ/soap4r.git
      Updating git://github.com/ManageIQ/simple-rss.git
      Updating git://github.com/ManageIQ/WinRM.git
      Updating git://github.com/ManageIQ/ziya.git
      Updating git://github.com/ManageIQ/metric_fu.git
      Updating git://github.com/ManageIQ/roodi.git
      Updating git://github.com/kina/simplecov-rcov-text.git
      Fetching source index from https://rubygems.org/
      Resolving dependencies...
      **> Bundler could not find compatible versions for gem "bundler":
        In Gemfile:
          bundler (~> 1.3.5) ruby
        Current Bundler version:
          bundler (1.7.4)
      This Gemfile requires a different version of Bundler.
      Perhaps you need to update Bundler by running `gem install bundler`?
      STDERR: 
      ---- End output of "bash"  "/tmp/chef-script20141105-13240-1de6n2l" ----
      Ran "bash"  "/tmp/chef-script20141105-13240-1de6n2l" returned 6**
      Cookbook Trace:
      ---------------
      /tmp/chef/cookbooks/rvm/providers/shell.rb:98:in `script_wrapper'
      /tmp/chef/cookbooks/rvm/providers/shell.rb:46:in `block in class_from_file'
      
      Resource Declaration:
      ---------------------
      # In /tmp/chef/cookbooks/rvm/providers/shell.rb
      
       75:   s = script new_resource.name do
       76:     interpreter   "bash"
       77: 
       78:     if new_resource.user
       79:       user        new_resource.user
       80:       if user_rvm && new_resource.environment
       81:         environment({ 'USER' => new_resource.user, 'HOME' => user_home }.merge(
       82:           new_resource.environment))
       83:       elsif user_rvm
       84:         environment({ 'USER' => new_resource.user, 'HOME' => user_home })
       85:       end
       86:     end
      
      Compiled Resource:
      ------------------
      # Declared in /tmp/chef/cookbooks/rvm/providers/shell.rb:75:in `script_wrapper'
      
      script("miq vmdb bundle install") do
        action [:nothing]
        retries 0
        retry_delay 2
        guard_interpreter :default
        command "\"bash\"  \"/tmp/chef-script20141105-13240-1de6n2l\""
        backup 5
        cwd "/opt/manageiq/vmdb"
        environment {"USER"=>"miqbuilder", "HOME"=>"/home/miqbuilder"}
        group "miqbuilder"
        returns [0]
        user "miqbuilder"
        code "    if [ -s \"${HOME}/.rvm/scripts/rvm\" ]; then\n      source \"${HOME}/.rvm/scripts/rvm\"\n    elif [ -s \"/etc/profile.d/rvm.sh\" ]; then\n      source \"/etc/profile.d/rvm.sh\"\n    fi\n\n    rvm use ruby-1.9.3-p550\n\n    bundle install --without qpid\n"
        interpreter "bash"
        cookbook_name :"chef-manageiq"
      end
      
    
    ================================================================================
    Error executing action `run` on resource 'rvm_shell[miq vmdb bundle install]'
    ================================================================================
    
    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    script[miq vmdb bundle install] (/tmp/chef/cookbooks/rvm/providers/shell.rb line 75) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '6'
    ---- Begin output of "bash"  "/tmp/chef-script20141105-13240-1de6n2l" ----
    STDOUT: Using /home/miqbuilder/.rvm/gems/ruby-1.9.3-p550
    Updating git://github.com/ManageIQ/rails.git
    Updating git://github.com/ManageIQ/fog.git
    Updating git://github.com/ManageIQ/handsoap.git
    Updating git://github.com/ManageIQ/rest-client.git
    Updating git://github.com/ManageIQ/rubywbem.git
    Updating git://github.com/ManageIQ/ruport.git
    Updating git://github.com/ManageIQ/actionwebservice.git
    Updating git://github.com/ManageIQ/ruby-net-ldap.git
    Updating git://github.com/ManageIQ/rubyrep.git
    Updating git://github.com/ManageIQ/soap4r.git
    Updating git://github.com/ManageIQ/simple-rss.git
    Updating git://github.com/ManageIQ/WinRM.git
    Updating git://github.com/ManageIQ/ziya.git
    Updating git://github.com/ManageIQ/metric_fu.git
    Updating git://github.com/ManageIQ/roodi.git
    Updating git://github.com/kina/simplecov-rcov-text.git
    Fetching source index from https://rubygems.org/
    Resolving dependencies...
    Bundler could not find compatible versions for gem "bundler":
      In Gemfile:
        bundler (~> 1.3.5) ruby
    
      Current Bundler version:
        bundler (1.7.4)
    
    This Gemfile requires a different version of Bundler.
    Perhaps you need to update Bundler by running `gem install bundler`?
    STDERR: 
    ---- End output of "bash"  "/tmp/chef-script20141105-13240-1de6n2l" ----
    Ran "bash"  "/tmp/chef-script20141105-13240-1de6n2l" returned 6
    
    Cookbook Trace:
    ---------------
    /tmp/chef/cookbooks/rvm/providers/shell.rb:98:in `script_wrapper'
    /tmp/chef/cookbooks/rvm/providers/shell.rb:46:in `block in class_from_file'
    
    Resource Declaration:
    ---------------------
    # In /tmp/chef/cookbooks/chef-manageiq/recipes/default.rb
    
    161: rvm_shell "miq vmdb bundle install" do
    162:   ruby_string "1.9.3"
    163:   user        "miqbuilder"
    164:   group       "miqbuilder"
    165:   cwd         "/opt/manageiq/vmdb"
    166:   code        %{bundle install --without qpid}
    167: end
    168: 
    
    Compiled Resource:
    ------------------
    # Declared in /tmp/chef/cookbooks/chef-manageiq/recipes/default.rb:161:in `from_file'
    
    rvm_shell("miq vmdb bundle install") do
      action :run
      retries 0
      retry_delay 2
      guard_interpreter :default
      cookbook_name :"chef-manageiq"
      recipe_name "default"
      ruby_string "1.9.3"
      user "miqbuilder"
      group "miqbuilder"
      cwd "/opt/manageiq/vmdb"
      code "bundle install --without qpid"
      returns [0]
    end
    

Running handlers:
[2014-11-05T12:59:10+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-11-05T12:59:10+00:00] ERROR: Exception handlers complete
[2014-11-05T12:59:10+00:00] FATAL: Stacktrace dumped to /tmp/chef/chef-stacktrace.out
Chef Client failed. 8 resources updated in 168.13592632 seconds
[2014-11-05T12:59:10+00:00] ERROR: rvm_shell[miq vmdb bundle install] (chef-manageiq::default line 161) had an error: Mixlib::ShellOut::ShellCommandFailed: script[miq vmdb bundle install] (/tmp/chef/cookbooks/rvm/providers/shell.rb line 75) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '6'
---- Begin output of "bash"  "/tmp/chef-script20141105-13240-1de6n2l" ----
STDOUT: Using /home/miqbuilder/.rvm/gems/ruby-1.9.3-p550
Updating git://github.com/ManageIQ/rails.git
Updating git://github.com/ManageIQ/fog.git
Updating git://github.com/ManageIQ/handsoap.git
Updating git://github.com/ManageIQ/rest-client.git
Updating git://github.com/ManageIQ/rubywbem.git
Updating git://github.com/ManageIQ/ruport.git
Updating git://github.com/ManageIQ/actionwebservice.git
Updating git://github.com/ManageIQ/ruby-net-ldap.git
Updating git://github.com/ManageIQ/rubyrep.git
Updating git://github.com/ManageIQ/soap4r.git
Updating git://github.com/ManageIQ/simple-rss.git
Updating git://github.com/ManageIQ/WinRM.git
Updating git://github.com/ManageIQ/ziya.git
Updating git://github.com/ManageIQ/metric_fu.git
Updating git://github.com/ManageIQ/roodi.git
Updating git://github.com/kina/simplecov-rcov-text.git
Fetching source index from https://rubygems.org/
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    bundler (~> 1.3.5) ruby

  Current Bundler version:
    bundler (1.7.4)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
STDERR: 
---- End output of "bash"  "/tmp/chef-script20141105-13240-1de6n2l" ----
Ran "bash"  "/tmp/chef-script20141105-13240-1de6n2l" returned 6
[2014-11-05T12:59:10+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
[root@ip-172-31-5-99 chef]#

#2

Are you git cloning the manageiq repo on github? If so, we fairly recently loosened the bundler version constraint in the master branch so 1.7.4 should be allowed and there isn’t a need to remove the newer bundler and install 1.3.5.

If you’re using an older version of the manageiq code, then it looks like your gem uninstall of the newer bundler isn’t working. I think there’s a way to tell rvm to not install default/global gems like bundler in the first place. That might simplify your recipe.

Additionally, we’re now targeting ruby 2.0 going forward, so the referenced instructions need to change soon.

I should have a blog post about ruby 2 by the end of the week. I’ll also see if I can post a pull request on the website for the referenced “running from source” page as there are steps we need to revise for ruby 2.0. I’ll update this thread when it’s ready.

Any feedback would help as I don’t use these instructions.


#3

Awesome! Thanks for your help. I’ll be sure to provide feedback when I see the updated instructions. I’ll try to update my version of the code and try to build it again today.


#4

@mandeep I have put up a work in progress pull request for the website with what I think you’d have to change to get things up and running with ruby 2.0 and bundler.

Let’s move specific discussion to the above PR.

Additionally, here is the pull request where we modified the building of the nightly appliance to utilize ruby-install to build ruby 2.0.0:


#5

Great - thanks, @jrafanie !


#6

Are you git cloning the manageiq repo on github? If so, we fairly recently loosened the bundler version constraint in the master branch so 1.7.4 should be allowed and there isn’t a need to use 1.3.5.
If you’re using an older version of the manageiq code, then it looks like your gem uninstall of the newer bundler isn’t working. I think there’s a way to tell rvm to not install default/global gems like bundler in the first place. That might simplify your recipe.

Additionally, we’re now targeting ruby 2.0 going forward, so the referenced instructions need to change soon.

I should have a blog post about ruby 2 by the end of the week. I’ll also see if I can post a pull request on the website for the referenced “running from source” page as there are steps we need to revise for ruby 2.0. I’ll update this thread when it’s ready.

Any feedback would help as I don’t use these instructions.