Skip to content

Commit

Permalink
RHELMISC-2863: Add retry logic to run for handling WinrmPSRunError
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Chulak <[email protected]>
  • Loading branch information
Jedoku committed Feb 12, 2025
1 parent 6473e3e commit 6a94d0f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/rtoolsHCK.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,18 @@ def validate_init_opts(init_opts)
end

def start_studio_service(service_name)
run("Start-Service #{service_name}")
retries = 0
timeout = 30
begin
run("Start-Service #{service_name}")
rescue WinrmPSRunError => e
raise e unless (retries += 1) < 3

logger('warn', "#{e.message} Retrying in #{timeout} seconds...")
sleep(timeout)

retry
end
end

def start_studio_services
Expand Down

0 comments on commit 6a94d0f

Please sign in to comment.