Make sure stdout always lines up with what is expected out ansible

Also, strip superflous extra newlines at the end of job events, this
helps downloaded stdout line up.
This commit is contained in:
Matthew Jones 2017-02-03 15:36:35 -05:00
parent e6dcf1f61a
commit 0139bccde3
3 changed files with 3 additions and 3 deletions

View File

@ -818,7 +818,7 @@ class OutputEventFilter(object):
for stdout_chunk in stdout_chunks:
event_data['counter'] = self._counter
self._counter += 1
event_data['stdout'] = stdout_chunk
event_data['stdout'] = stdout_chunk[:-2] if len(stdout_chunk) > 2 else ""
n_lines = stdout_chunk.count('\n')
event_data['start_line'] = self._start_line
event_data['end_line'] = self._start_line + n_lines

View File

@ -215,7 +215,7 @@ export default ['$log', 'moment', function($log, moment){
let padBy = lineNums.length - lines.length;
for (let i = 0; i <= padBy; i++) {
lines.push("[1;imLine capped.[0m");
lines.push("");
}
}

View File

@ -129,7 +129,7 @@ describe('parseStdoutService', () => {
end_line: 11,
stdout: "a\r\nb\r\nc..."
};
let expectedReturn = [[8, "a"],[9, "b"], [10,"c..."], [11, "[1;imLine capped.[0m"]];
let expectedReturn = [[8, "a"],[9, "b"], [10,"c..."], [11, ""]];
let returnedEvent = parseStdoutService.getLineArr(mockEvent);