Skip to content

Commit

Permalink
Fix FileNotFoundException during SubmitJobSync operation (#92)
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoli-Kalbasin1 <[email protected]>
Co-authored-by: Anatoli-Kalbasin1 <[email protected]>
  • Loading branch information
callbacksin and Anatoli-Kalbasin1 authored Nov 12, 2024
1 parent 00035ca commit a5f93d6
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/main/kotlin/org/zowe/zdevops/logic/SubmitJobOperation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,18 @@ fun submitJobSync(
val fullLog = spoolFiles.joinToString { GetJobs(zosConnection).getSpoolContent(it) }
val logPath = "$workspacePath/${finalResult.jobName}.${finalResult.jobId}"
val file = File(logPath)
file.writeText(fullLog)
listener.logger.println(Messages.zdevops_declarative_ZOSJobs_got_log(
HyperlinkNote.encodeTo(
linkBuilder(buildUrl, finalResult.jobName, finalResult.jobId),
"${finalResult.jobName}.${finalResult.jobId}"
)
))
try {
file.writeText(fullLog)
listener.logger.println(Messages.zdevops_declarative_ZOSJobs_got_log(
HyperlinkNote.encodeTo(
linkBuilder(buildUrl, finalResult.jobName, finalResult.jobId),
"${finalResult.jobName}.${finalResult.jobId}"
)
))
} catch (ex: Exception) {
listener.logger.println("[WARNING] - Couldn't write the log to a file in workspace. The problem was: " + ex.message)
listener.logger.println("Posting logs here: \n$fullLog")
}
} else {
listener.logger.println(Messages.zdevops_no_spool_files(submitJobRsp.jobid))
}
Expand Down

0 comments on commit a5f93d6

Please sign in to comment.