Skip to content

Commit

Permalink
Refs #37320 - Set real timestamps on outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamruzicka committed Nov 1, 2024
1 parent f20ac2e commit 080b056
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/smart_proxy_ansible/runner/ansible_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def hostname_for_event(event)

def handle_host_event(hostname, event)
log_event("for host: #{hostname.inspect}", event)
publish_data_for(hostname, event['stdout'] + "\n", 'stdout', id: event['uuid']) if event['stdout']
publish_data_for(hostname, event['stdout'] + "\n", 'stdout', id: event['uuid'], timestamp: event['created']) if event['stdout']
case event['event']
when 'runner_on_ok'
publish_exit_status_for(hostname, 0) if @exit_statuses[hostname].nil?
Expand All @@ -149,15 +149,15 @@ def handle_broadcast_data(event)
broadcast_data("\n" + header + "\n", 'stdout')
@outputs.keys.select { |key| key.is_a? String }.each do |host|
line = rows.find { |row| row =~ /#{host}/ }
publish_data_for(host, line + "\n", 'stdout', id: event['uuid'])
publish_data_for(host, line + "\n", 'stdout', id: event['uuid'], timestamp: event['created'])

# If the task has been rescued, it won't consider a failure
if @exit_statuses[host].to_i != 0 && failures[host].to_i <= 0 && unreachable[host].to_i <= 0 && rescued[host].to_i > 0
publish_exit_status_for(host, 0)
end
end
else
broadcast_data(event['stdout'] + "\n", 'stdout', id: event['uuid'])
broadcast_data(event['stdout'] + "\n", 'stdout', id: event['uuid'], timestamp: event['created'])
end

# If the run ends early due to an error - fail all other tasks
Expand Down

0 comments on commit 080b056

Please sign in to comment.