aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor')
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt6
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt3
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt3
3 files changed, 9 insertions, 3 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 00f8e5a19..eaefde7ce 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
@@ -209,11 +209,15 @@ open class ComponentRemotePythonExecutor(
}
val logs = JacksonUtils.jsonNodeFromObject(remoteExecutionOutput.response)
val returnedPayload = remoteExecutionOutput.payload
+ val returnedErrMsg = remoteExecutionOutput.errMsg
// In case of execution, `payload` (dictionary from Python execution) is preserved in `remoteExecutionOutput.payload`;
// It would contain `err_msg` key. It is valid to return it.
if (remoteExecutionOutput.status != StatusType.SUCCESS) {
setNodeOutputErrors(STEP_EXEC_CMD, logs, returnedPayload, isLogResponseEnabled)
- addError(StatusType.FAILURE.name, STEP_EXEC_CMD, logs.toString())
+ // check if the payload is set (in case user Python script handles the error and sets the payload to return
+ val retErrMsg: String = if (returnedErrMsg.isNullOrEmpty()) "cmd-exec has failed, please see cmd-exec log for more details."
+ else "cmd-exec failed and returned: $returnedErrMsg"
+ addError(StatusType.FAILURE.name, STEP_EXEC_CMD, retErrMsg)
} else {
setNodeOutputProperties(remoteExecutionOutput.status, STEP_EXEC_CMD, logs, returnedPayload, isLogResponseEnabled)
} // In timeout exception cases, we don't have payload, hence `payload` is empty value.
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
index d8baa8eaf..b62ffb898 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
@@ -69,7 +69,8 @@ data class RemoteScriptExecutionOutput(
var response: List<String>,
var status: StatusType = StatusType.SUCCESS,
var timestamp: Date = Date(),
- var payload: JsonNode
+ var payload: JsonNode,
+ var errMsg: String?
)
data class PrepareRemoteEnvInput(
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
index ff6027341..26375e081 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
@@ -207,7 +207,8 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
requestId = this.requestId,
response = this.responseList,
status = StatusType.valueOf(this.status.name),
- payload = payload.jsonAsJsonType()
+ payload = payload.jsonAsJsonType(),
+ errMsg = errMsg
)
}