Fix undefined property error when task is of type yum/debug and was s… (#14372)

Signed-off-by: Ivanilson Junior <ivanilsonaraujojr@gmail.com>
This commit is contained in:
Ivanilson Junior 2023-08-30 16:37:28 -03:00 committed by GitHub
parent 224e9e0324
commit cf1e448577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,13 +53,9 @@ const getStdOutValue = (hostEvent) => {
const res = hostEvent?.event_data?.res;
let stdOut;
if (taskAction === 'debug' && res.result && res.result.stdout) {
if (taskAction === 'debug' && res?.result?.stdout) {
stdOut = res.result.stdout;
} else if (
taskAction === 'yum' &&
res.results &&
Array.isArray(res.results)
) {
} else if (taskAction === 'yum' && Array.isArray(res?.results)) {
stdOut = res.results.join('\n');
} else if (res?.stdout) {
stdOut = Array.isArray(res.stdout) ? res.stdout.join(' ') : res.stdout;