aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Mitsura <oleg.mitsura@amdocs.com>2020-07-23 10:02:43 -0400
committerOleg Mitsura <omitsura@gmail.com>2020-08-04 04:47:03 +0000
commiteaa4bf55ab5198f965282762c99975945f5b5074 (patch)
treec9923edb33efc88805d2784010a00f3b3b9b7652
parentba4a47cff12b51762a3eba4d16687ec2ce2d7a91 (diff)
cds-exec shouldn't return "N/A" as output
Issue-ID: CCSDK-2603 * execute-command-logs" should always be a list (in some cases, we had a string causing possible parsing problems) * response-data should be JSON and "N/A" not acceptible. Signed-off-by: Oleg Mitsura <oleg.mitsura@amdocs.com> Change-Id: Ie6fceb6e1f4c86bfcdeb7671bacd74b909628096
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt16
1 files changed, 8 insertions, 8 deletions
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
index ecc3d2e65..3e6e5db0a 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
@@ -155,7 +155,7 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
// there are no artifacts for env. prepare, but we reuse it for err_log...
if (prepareEnvOutput.status != StatusType.SUCCESS) {
- setNodeOutputErrors(STEP_PREPARE_ENV, "".asJsonPrimitive(), prepareEnvOutput.payload, isLogResponseEnabled)
+ setNodeOutputErrors(STEP_PREPARE_ENV, "[]".asJsonPrimitive(), prepareEnvOutput.payload, isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_PREPARE_ENV, logs.toString())
} else {
setNodeOutputProperties(prepareEnvOutput.status, STEP_PREPARE_ENV, logs, prepareEnvOutput.payload, isLogResponseEnabled)
@@ -172,7 +172,7 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
// no execution log in case of timeout (as cmd-exec side hasn't finished to transfer output)
// set prepare-env-log to the error msg, and cmd-exec-log to empty
setAttribute(ATTRIBUTE_PREPARE_ENV_LOG, grpcErrMsg.asJsonPrimitive())
- setNodeOutputErrors(STEP_PREPARE_ENV, "".asJsonPrimitive(), "".asJsonPrimitive(), isLogResponseEnabled)
+ setNodeOutputErrors(STEP_PREPARE_ENV, "[]".asJsonPrimitive(), "{}".asJsonPrimitive(), isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_PREPARE_ENV, grpcErrMsg)
log.error(grpcErrMsg, grpcEx)
addError(grpcErrMsg)
@@ -180,7 +180,7 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
val catchallErrMsg = "Command executor failed during env. preparation.. catch-all case. timeout($envPrepTimeout) requestId ($processId). exception msg: ${e.message}"
// no environment prepare log from executor in case of timeout (as cmd-exec side hasn't finished to transfer output), set it to error msg. Execution logs is empty.
setAttribute(ATTRIBUTE_PREPARE_ENV_LOG, catchallErrMsg.asJsonPrimitive())
- setNodeOutputErrors(STEP_PREPARE_ENV, "".asJsonPrimitive(), "".asJsonPrimitive(), isLogResponseEnabled)
+ setNodeOutputErrors(STEP_PREPARE_ENV, "[]".asJsonPrimitive(), "{}".asJsonPrimitive(), isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_PREPARE_ENV, catchallErrMsg)
log.error(catchallErrMsg, e)
}
@@ -221,17 +221,17 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
} catch (timeoutEx: TimeoutCancellationException) {
val componentLevelWarningMsg = if (timeout < executionTimeout) "Note: component-level timeout ($timeout) is shorter than execution timeout ($executionTimeout). " else ""
val timeoutErrMsg = "Command executor execution timeout. DetailedMessage: (${timeoutEx.message}) requestId ($processId). $componentLevelWarningMsg"
- setNodeOutputErrors(STEP_EXEC_CMD, timeoutErrMsg.asJsonPrimitive(), logging = isLogResponseEnabled)
+ setNodeOutputErrors(STEP_EXEC_CMD, listOf(timeoutErrMsg).asJsonPrimitive(), logging = isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_EXEC_CMD, timeoutErrMsg)
log.error(timeoutErrMsg, timeoutEx)
} catch (grpcEx: io.grpc.StatusRuntimeException) {
val timeoutErrMsg = "Command executor timed out executing after $executionTimeout seconds requestId ($processId) grpcErr: ${grpcEx.status}"
- setNodeOutputErrors(STEP_EXEC_CMD, timeoutErrMsg.asJsonPrimitive(), logging = isLogResponseEnabled)
+ setNodeOutputErrors(STEP_EXEC_CMD, listOf(timeoutErrMsg).asJsonPrimitive(), logging = isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_EXEC_CMD, timeoutErrMsg)
log.error(timeoutErrMsg, grpcEx)
} catch (e: Exception) {
val catchAllErrMsg = "Command executor failed during process catch-all case requestId ($processId) timeout($envPrepTimeout) exception msg: ${e.message}"
- setNodeOutputErrors(STEP_PREPARE_ENV, catchAllErrMsg.asJsonPrimitive(), logging = isLogResponseEnabled)
+ setNodeOutputErrors(STEP_PREPARE_ENV, listOf(catchAllErrMsg).asJsonPrimitive(), logging = isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_EXEC_CMD, catchAllErrMsg)
log.error(catchAllErrMsg, e)
}
@@ -282,8 +282,8 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
*/
private fun setNodeOutputErrors(
step: String,
- executionLogs: JsonNode = "N/A".asJsonPrimitive(),
- artifacts: JsonNode = "N/A".asJsonPrimitive(),
+ executionLogs: JsonNode = "[]".asJsonPrimitive(),
+ artifacts: JsonNode = "{}".asJsonPrimitive(),
logging: Boolean = true
) {
val status = StatusType.FAILURE.name