Skip to content

Commit

Permalink
Add rescue for Net::HTTPServerException. Fixes #1
Browse files Browse the repository at this point in the history
* Add log warn with exception message
* Add Chef::Config[:data_bag_path] in log message
  • Loading branch information
madwork committed Aug 15, 2014
1 parent 369cac6 commit adf4cf4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions recipes/rubies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@

begin
rubies = data_bag('rubies').map{ |rubie| data_bag_item('rubies', rubie) }
rescue Chef::Exceptions::InvalidDataBagPath, Chef::Exceptions::InvalidDataBagName
Log.info "Missing data bags directory data_bags/rubies, try with node attributes."
rescue Chef::Exceptions::InvalidDataBagPath, Chef::Exceptions::InvalidDataBagName, Net::HTTPServerException => ex
Log.warn ex.message
Log.info "Missing data bags directory #{Chef::Config[:data_bag_path]}/rubies, try with node attributes."
end

rubies ||= node['chruby_build']['rubies']
Expand Down

1 comment on commit adf4cf4

@Aupajo
Copy link

@Aupajo Aupajo commented on adf4cf4 Aug 16, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

Please sign in to comment.