Skip to content

Commit

Permalink
fix(kubernetes): Improve error message on kubectl failure (#3757)
Browse files Browse the repository at this point in the history
If a call to kubectl fails to parse the output, we'll return
a parsing failure directly to the user. Instead, return a
failed job with the error message and let the caller handle
the exception as it would any other failed job.
  • Loading branch information
ezimanyi committed Jun 6, 2019
1 parent 193bc1c commit b1dec34
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,13 @@ private <T> JobResult<T> executeStreaming(JobRequest jobRequest, ReaderConsumer<
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
executor.execute(jobRequest.getCommandLine(), jobRequest.getEnvironment(), resultHandler);

T result =
consumer.consume(new BufferedReader(new InputStreamReader(new PipedInputStream(stdOut))));
T result;
try {
result =
consumer.consume(new BufferedReader(new InputStreamReader(new PipedInputStream(stdOut))));
} catch (IOException e) {
return JobResult.<T>builder().result(JobResult.Result.FAILURE).error(e.toString()).build();
}

try {
resultHandler.waitFor();
Expand Down

0 comments on commit b1dec34

Please sign in to comment.