Fix empty dict in the script arguments when running a script in the cmd-exec
[ccsdk/cds.git] / ms / command-executor / src / main / python / command_executor_handler.py
index eec3857..06004b5 100644 (file)
@@ -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