edelight / chef-solo-search

Data bag search for Chef Solo
Apache License 2.0
177 stars 2 forks source link

cookbook throws LoadError exception - which is not handled by rescue #64

Open jjeffers opened 9 years ago

jjeffers commented 9 years ago

When using this cookbook as part of a vagrant/chef-solo run, I see the following:

==> default: ================================================================================
==> default: Recipe Compile Error in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/solo-search/libraries/search.rb
==> default: ================================================================================
==> default: 
==> default: 
==> default: Gem::LoadError
==> default: --------------
==> default: chef_gem[treetop] (dynamically defined) had an error: Gem::LoadError: Could not find 'treetop' (= 1.5.1) - did find: [treetop-1.5.3]
==> default: Checked in 'GEM_PATH=/root/.gem/ruby/1.9.1:/usr/lib/ruby/gems/1.9.1', execute `gem env` for more information
==> default: 
==> default: 
==> default: Cookbook Trace:
==> default: ---------------
==> default:   /tmp/vagrant-chef-3/chef-solo-1/cookbooks/solo-search/libraries/search.rb:33:in `<top (required)>'
==> default: 
==> default: 
==> default: Relevant File Content:
==> default: ----------------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/solo-search/libraries/search.rb:
==> default: 
==> default:  26:    # All chef/solr_query/* classes were removed in Chef 11; Load vendored copy
==> default:  27:    # that ships with this cookbook
==> default:  28:    $: << File.expand_path("vendor", File.dirname(__FILE__)) if Chef::VERSION.to_i >= 11
==> default:  29:  
==> default:  30:    # Ensure the treetop gem is installed and available
==> default:  31:    treetop_loadable = false
==> default:  32:    begin
==> default:  33>>     gem 'treetop', '=1.5.1'
==> default:  34:      require 'treetop'
==> default:  35:      treetop_loadable = true
==> default:  36:    rescue LoadError
==> default:  37:      run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new)
==> default:  38:      chef_gem = Chef::Resource::ChefGem.new("treetop", run_context)
==> default:  39:      chef_gem.version('= 1.5.1')
==> default:  40:      chef_gem.run_action(:install)
==> default:  41:      #chef gem isn't run in whyrun mode
==> default:  42:      treetop_loadable = !Chef::Config[:why_run]
==> default: 
==> default: 
==> default: 
==> default: [2014-10-16T15:40:32+00:00] INFO: Forking chef instance to converge...
==> default: [2014-10-16T15:40:41+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
michaelglass commented 9 years ago

I would expect this if treetop had been yanked.

michaelglass commented 9 years ago

updated treetop to 1.5.3. Haven't dived in to see why this breaks, though.

michaelglass commented 9 years ago

please feel free to close if the issue goes away

frankf-cgn commented 9 years ago

I think that this error remains, it is just the second run which wil succeed, because then the gem "treetop" is installed. I have no idea, why despite the rescue-block this exception bubbles up. Anyone?