Skip to content

Commit

Permalink
retry keyword can only be used in a rescue block in Ruby 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
schisamo committed Oct 24, 2011
1 parent 1b07e8b commit 31c86ac
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions windows/providers/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,21 @@
require 'timeout'
Timeout.timeout(120) do
@new_resource.values.each do |value_name, value_data|
5.times do |x|
i = 1
until i > 5 do
desired_value_data = value_data
current_value_data = get_value(@new_resource.key_name.dup, value_name.dup)
if current_value_data.to_s == desired_value_data.to_s
Chef::Log.debug("#{@new_resource} value [#{value_name}] desired [#{desired_value_data}] data already set. Check #{x+1}/5.")
Chef::Log.debug("#{@new_resource} value [#{value_name}] desired [#{desired_value_data}] data already set. Check #{i}/5.")
i+=1
else
Chef::Log.debug("#{@new_resource} value [#{value_name}] current [#{current_value_data}] data not equal to desired [#{desired_value_data}] data. Setting value and restarting check loop.")
begin
registry_update(:open)
rescue Exception
registry_update(:create)
end
retry # start count loop over
i=0 # start count loop over
end
end
end
Expand Down

0 comments on commit 31c86ac

Please sign in to comment.