Skip to content

Commit

Permalink
(CAT-1241) - Adding retry when provision failed with Timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramesh7 committed Jul 28, 2023
1 parent edf7413 commit 0156168
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/puppet_litmus/rake_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
task :provision, [:provisioner, :platform, :inventory_vars] do |_task, args|
Rake::Task['spec_prep'].invoke

retry_count = 3
current_retry_count = 0
begin
spinner = start_spinner("Provisioning #{args[:platform]} using #{args[:provisioner]} provisioner.")

Expand All @@ -94,6 +96,13 @@
check_connectivity?(inventory_hash_from_inventory_file, target)
end
end
rescue PuppetLitmus::RakeHelper::LitmusTimeoutError
current_retry_count += 1
Rake::Task['litmus:tear_down'].invoke(target_names.first)
raise if current_retry_count >= retry_count

puts "Provision of node #{target_names.first} failed, Retrying #{current_retry_count} of #{retry_count}"
retry
ensure
stop_spinner(spinner)
end
Expand Down

0 comments on commit 0156168

Please sign in to comment.