summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/python-executor/src
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-07-08 13:34:22 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-08 13:34:22 +0000
commitbf228082d558a2e1c7a93dd2334dfd105483fc2f (patch)
tree2cf7f547dc33e9f559e2bac2ad07a25993d6173d /ms/blueprintsprocessor/functions/python-executor/src
parentd4b56bc36db1169024fef1f54f924bf3b8f351b6 (diff)
parent6be51a1061db5719e49eb2ec99573256214aabe7 (diff)
Merge "Remote Python executor unescapes script parameter values"
Diffstat (limited to 'ms/blueprintsprocessor/functions/python-executor/src')
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt16
1 files changed, 14 insertions, 2 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 2de22424e..c45fb881f 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
@@ -16,6 +16,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor
+import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceConstant
@@ -75,8 +76,19 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
val dynamicProperties = getOptionalOperationInput(INPUT_DYNAMIC_PROPERTIES)
val packages = getOptionalOperationInput(INPUT_PACKAGES)?.returnNullIfMissing()
- val args = getOptionalOperationInput(INPUT_ARGUMENT_PROPERTIES)?.returnNullIfMissing()
- ?.rootFieldsToMap()?.toSortedMap()?.values?.map { it.textValue() }?.joinToString(" ")
+ 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 command = getOperationInput(INPUT_COMMAND).asText()
var scriptCommand = command.replace(pythonScript.name, pythonScript.absolutePath)