Source:
public int processEvents(String playUuid, int lastEventId, BiConsumer<String, String> fn) { JsonNode responseNode = getEvents(playUuid); JsonNode eventNodes = RunnerJsonNode.eventNodes(responseNode); Set<String> events = sortedEvents(eventNodes.getFieldNames(), lastEventId); for (String n : events) { String task = null; JsonNode currentNode = eventNodes.get(n); JsonNode taskNode = currentNode.get("task"); if (taskNode != null) { task = taskNode.getTextValue(); } if (RunnerJsonNode.isEventStart(currentNode) || RunnerJsonNode.isEventOk(currentNode) || RunnerJsonNode.playbookStats(currentNode) || RunnerJsonNode.isEventFailed(currentNode) || RunnerJsonNode.isEventError(currentNode) ) { JsonNode okNode = readUrl(String.format("jobs/%1$s/events/%2$s", playUuid, n)); JsonNode data = okNode.get("data"); String stdout = RunnerJsonNode.getStdout(data); runnerLogger.log(stdout.trim()); String stderr = RunnerJsonNode.getStderr(data); runnerLogger.log(stderr); if (RunnerJsonNode.isEventOk(currentNode)) { if (taskNode != null) { runnerLogger.log(readUrl(String.format("jobs/%1$s/events/%2$s", playUuid, n))); fn.accept(taskNode.getTextValue(), String.format("jobs/%1$s/events/%2$s", playUuid, n)); } } else if (RunnerJsonNode.isEventFailed(currentNode) || RunnerJsonNode.isEventError(currentNode)) { JsonNode event = getEvent(String.format("jobs/%1$s/events/%2$s", playUuid, n)); if (!RunnerJsonNode.ignore(event)) { runnerLogger.log(readUrl(String.format("jobs/%1$s/events/%2$s", playUuid, n))); throw new AnsibleRunnerCallException( String.format("Task %1$s failed to execute: %2$s", task, "") ); } } } } return RunnerJsonNode.totalEvents(responseNode); }

Target:
public int processEvents(String playUuid, int lastEventId, BiConsumer<String, String> fn) { JsonNode responseNode = getEvents(playUuid); JsonNode eventNodes = RunnerJsonNode.eventNodes(responseNode); Set<String> events = sortedEvents(eventNodes.getFieldNames(), lastEventId); for (String event : events) { String task = null; JsonNode currentNode = eventNodes.get(event); JsonNode taskNode = currentNode.get("task"); if (taskNode != null) { task = taskNode.getTextValue(); } if (RunnerJsonNode.isEventStart(currentNode) || RunnerJsonNode.isEventOk(currentNode) || RunnerJsonNode.playbookStats(currentNode) || RunnerJsonNode.isEventFailed(currentNode) || RunnerJsonNode.isEventError(currentNode) ) { JsonNode okNode = readUrl(String.format("jobs/%1$s/events/%2$s", playUuid, event)); JsonNode data = okNode.get("data"); String stdout = RunnerJsonNode.getStdout(data); runnerLogger.log(stdout.trim()); String stderr = RunnerJsonNode.getStderr(data); runnerLogger.log(stderr); if (RunnerJsonNode.isEventOk(currentNode)) { if (taskNode != null) { runnerLogger.log(readUrl(String.format("jobs/%1$s/events/%2$s", playUuid, event))); fn.accept(taskNode.getTextValue(), String.format("jobs/%1$s/events/%2$s", playUuid, event)); } } else if (RunnerJsonNode.isEventFailed(currentNode) || RunnerJsonNode.isEventError(currentNode)) { JsonNode eventNode = getEvent(String.format("jobs/%1$s/events/%2$s", playUuid, event)); if (!RunnerJsonNode.ignore(eventNode)) { runnerLogger.log(readUrl(String.format("jobs/%1$s/events/%2$s", playUuid, event))); throw new AnsibleRunnerCallException( String.format("Task %1$s failed to execute: %2$s", task, "") ); } } } } return RunnerJsonNode.totalEvents(responseNode); }