summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/python-executor
diff options
context:
space:
mode:
authorOleg Mitsura <oleg.mitsura@amdocs.com>2019-07-10 15:48:53 -0400
committerOleg Mitsura <oleg.mitsura@amdocs.com>2019-07-10 15:50:39 -0400
commita013b2936f83eb663606959286a8679c3ddfd68d (patch)
treeae7a1d3148cb01fd07f88ab7f09624410aa293c9 /ms/blueprintsprocessor/functions/python-executor
parente827a3aee231453f704fef1a945d13de380a83c5 (diff)
Python executor parameters sorted again.
Issue-ID: CCSDK-1468 Signed-off-by: Oleg Mitsura <oleg.mitsura@amdocs.com> Change-Id: If8eb50fc2e8dfa084e486b02ace163eee1bfac77
Diffstat (limited to 'ms/blueprintsprocessor/functions/python-executor')
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt22
1 files changed, 12 insertions, 10 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 c45fb881f..fa5d882b0 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
@@ -79,16 +79,8 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
val argsNode = getOptionalOperationInput(INPUT_ARGUMENT_PROPERTIES)?.returnNullIfMissing()
// This prevents unescaping values, as well as quoting the each parameter, in order to allow for spaces in values
- var args = ""
- argsNode?.fields()?.forEach {
- if (it.value.isValueNode) {
- args = "$args ${it.value}"
- } else {
- it.value.fields().forEach { item ->
- args = "$args ${item.value}"
- }
- }
- }
+ val args = getOptionalOperationInput(INPUT_ARGUMENT_PROPERTIES)?.returnNullIfMissing()
+ ?.rootFieldsToMap()?.toSortedMap()?.values?.joinToString(" ") { formatNestedJsonNode(it) }
val command = getOperationInput(INPUT_COMMAND).asText()
var scriptCommand = command.replace(pythonScript.name, pythonScript.absolutePath)
@@ -141,4 +133,14 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
bluePrintRuntimeService.getBluePrintError()
.addError("Failed in ComponentJythonExecutor : ${runtimeException.message}")
}
+
+ private fun formatNestedJsonNode(node: JsonNode): String {
+ val sb = StringBuilder()
+ if (node.isValueNode) {
+ sb.append(" $node")
+ } else {
+ node.forEach { sb.append(" $it") }
+ }
+ return sb.toString()
+ }
}