summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKAPIL SINGAL <ks220y@att.com>2020-07-31 13:05:05 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-31 13:05:05 +0000
commit260b95f2a1fe773bb1e89150164ae2a7c880be04 (patch)
treeb252275acd75cc2609a3b36397cae6b9149f9e01
parent507ce6db6765cc8215a05446a7777d97af176898 (diff)
parent2f2739d2a7d5ca8edddb62101368c7605c8460d1 (diff)
Merge "Fix empty dict in the script arguments when running a script in the cmd-exec"
-rw-r--r--ms/command-executor/src/main/python/command_executor_handler.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ms/command-executor/src/main/python/command_executor_handler.py b/ms/command-executor/src/main/python/command_executor_handler.py
index eec385783..06004b551 100644
--- a/ms/command-executor/src/main/python/command_executor_handler.py
+++ b/ms/command-executor/src/main/python/command_executor_handler.py
@@ -104,11 +104,16 @@ class CommandExecutorHandler():
cmd = "cd " + self.venv_home
+ ### if properties are defined we add them to the command
+ properties = ""
+ if request.properties is not None and len(request.properties) > 0:
+ properties = " " + re.escape(MessageToJson(request.properties))
+
### TODO: replace with os.environ['VIRTUAL_ENV']?
if "ansible-playbook" in request.command:
cmd = cmd + "; " + request.command + " -e 'ansible_python_interpreter=" + self.venv_home + "/bin/python'"
else:
- cmd = cmd + "; " + request.command + " " + re.escape(MessageToJson(request.properties))
+ cmd = cmd + "; " + request.command + properties
### extract the original header request into sys-env variables
### RequestID