aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-04-19 00:10:59 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-19 00:10:59 +0000
commit0aab720504b3b4e26e412cb228e9c2ffa2f4a9b3 (patch)
tree3f5f3ed008586e273fce51b5c5f4b6fb6bd82019
parent83f51950dd6934ee404bc452bfa0ff80a938bb52 (diff)
parent01cbd5c7ea7b554f229ff3735d5352038f8b4419 (diff)
Merge "Add support to command to execute for remote python"
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json5
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/python/SamplePython.py5
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json5
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt4
5 files changed, 21 insertions, 1 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json
index d7002cdea..cd63f0091 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json
@@ -29,6 +29,11 @@
"description": "Dynamic Json Content or DSL Json reference.",
"required": false,
"type": "json"
+ },
+ "command": {
+ "description": "Command to execute.",
+ "required": true,
+ "type": "string"
}
}
}
diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json
index 7c279010d..464911478 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json
@@ -65,6 +65,9 @@
"dependencies": [
"pyaml"
]
+ },
+ "inputs": {
+ "command": "python SamplePython.py blah"
}
}
}
diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/python/SamplePython.py b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/python/SamplePython.py
index e69de29bb..5e20e2291 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/python/SamplePython.py
+++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/python/SamplePython.py
@@ -0,0 +1,5 @@
+#!/usr/bin/python
+
+import sys
+
+print(sys.argv[1]) \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json
index 9c3c90ba8..99a4dd8dc 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json
@@ -27,6 +27,11 @@
"description": "Dynamic Json Content or DSL Json reference.",
"required": false,
"type": "json"
+ },
+ "command": {
+ "description": "Command to execute.",
+ "required": true,
+ "type": "string"
}
}
}
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 a243f44bf..6437cdf03 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
@@ -46,6 +46,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_COMMAND = "command"
}
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
@@ -73,9 +74,10 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
val endPointSelector = getOperationInput(INPUT_ENDPOINT_SELECTOR)
val dynamicProperties = getOperationInput(INPUT_DYNAMIC_PROPERTIES)
+ val command = getOperationInput(INPUT_COMMAND).asText()
// TODO("Python execution command and Resolve some expressions with dynamic properties")
- val scriptCommand = pythonScript.absolutePath
+ val scriptCommand = command.replace(pythonScript.name, pythonScript.absolutePath)
val dependencies = operationAssignment.implementation?.dependencies