From 5a82232d3502a566466fac1f8d6f6aadc50fbc6e Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Fri, 19 Apr 2019 11:42:47 -0400 Subject: Support for dynamic property in command args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I47c65557a553c79fefbbc28f8dab54b1c0a4a798 Issue-ID: CCCSDK-125 Signed-off-by: Alexis de Talhouët --- .../functions/python/executor/ComponentRemotePythonExecutor.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ms/blueprintsprocessor/functions') 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 488e0d054..df92d7157 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 @@ -28,6 +28,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.checkFileExists import org.onap.ccsdk.cds.controllerblueprints.core.checkNotBlank import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintVelocityTemplateService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.slf4j.LoggerFactory import org.springframework.beans.factory.config.ConfigurableBeanFactory @@ -47,6 +48,7 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic companion object { const val INPUT_ENDPOINT_SELECTOR = "endpoint-selector" const val INPUT_DYNAMIC_PROPERTIES = "dynamic-properties" + const val INPUT_ARGUMENT_PROPERTIES = "argument-properties" const val INPUT_COMMAND = "command" const val INPUT_PACKAGES = "packages" @@ -79,11 +81,12 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic val endPointSelector = getOperationInput(INPUT_ENDPOINT_SELECTOR) val dynamicProperties = getOperationInput(INPUT_DYNAMIC_PROPERTIES) - val command = getOperationInput(INPUT_COMMAND).asText() val packages = getOperationInput(INPUT_PACKAGES) + val argumentProperties = getOperationInput(INPUT_ARGUMENT_PROPERTIES) - // TODO("Python execution command and Resolve some expressions with dynamic properties") - val scriptCommand = command.replace(pythonScript.name, pythonScript.absolutePath) + var command = getOperationInput(INPUT_COMMAND).asText() + command = command.replace(pythonScript.name, pythonScript.absolutePath) + val scriptCommand = BluePrintVelocityTemplateService.generateContent(command, json = JacksonUtils.getJson(argumentProperties)) try { // Open GRPC Connection -- cgit 1.2.3-korg