Skip to content

Commit

Permalink
address code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
smurawski committed Jun 16, 2016
1 parent e4878ed commit 0cf416e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion lib/kitchen/command.rb
Expand Up @@ -170,7 +170,6 @@ def run_action(action, instances, *args)
concurrency.times do
threads << Thread.new do
while instance = queue.pop
puts "running #{instance.name}"
run_action_in_thread(action, instance, *args)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/kitchen/provisioner/base.rb
Expand Up @@ -33,8 +33,8 @@ class Base
default_config :ftp_proxy, nil

default_config :retry_on_exit_code, []
default_config :max_retries, nil
default_config :wait_for_retry, nil
default_config :max_retries, 1
default_config :wait_for_retry, 30

default_config :root_path do |provisioner|
provisioner.windows_os? ? "$env:TEMP\\kitchen" : "/tmp/kitchen"
Expand Down
6 changes: 2 additions & 4 deletions lib/kitchen/transport/base.rb
Expand Up @@ -117,16 +117,14 @@ def execute(command)
# @param wait_time [Fixnum] number of seconds to wait before retrying command
# @raise [TransportFailed] if the command does not exit successfully,
# which may vary by implementation
def execute_with_retry(command, retryable_exit_codes = [], max_retries, wait_time)
max_retries = 1 if max_retries.nil?
wait_time = 30 if wait_time.nil?
def execute_with_retry(command, retryable_exit_codes = [], max_retries = 1, wait_time = 30)
tries = 0
begin
tries += 1
debug("Attempting to execute command - try #{tries} of #{max_retries}.")
execute(command)
rescue Kitchen::Transport::TransportFailed => e
if retry? tries, max_retries, retryable_exit_codes, e.exit_code
if retry?(tries, max_retries, retryable_exit_codes, e.exit_code)
close
sleep wait_time
retry
Expand Down

0 comments on commit 0cf416e

Please sign in to comment.