Skip to content

Commit

Permalink
Stream output
Browse files Browse the repository at this point in the history
  • Loading branch information
gkranis committed Apr 21, 2023
1 parent 1d608b4 commit d970456
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/kitchen/provisioner/ansible_push.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,14 @@ def run_command
def exec_ansible_command(env, command, desc)
debug("env=#{env} command=#{command}")
stdout_and_stderr, exit_code = Open3.capture2e(env, command.to_s)
info(stdout_and_stderr)
debug("ansible-playbook exit code = #{exit_code}")
raise UserError, "#{desc} returned a non zero #{exit_code}. Please see the output above." if exit_code.to_i != 0
Open3.popen2e(env, command.to_s) do |stdin, stdout_and_stderr, status_thread|
stdout_and_stderr.each_line do |line|
info(line)
end
exit_code = status_thread.value
debug("ansible-playbook exit code = #{exit_code}")
raise UserError, "#{desc} returned a non zero #{exit_code}. Please see the output above." if exit_code.to_i != 0
end
end

def instance_connection_option
Expand Down

0 comments on commit d970456

Please sign in to comment.