summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ms/command-executor/src/main/python/command_executor_handler.py12
1 files changed, 10 insertions, 2 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 c920dda89..3219a974b 100644
--- a/ms/command-executor/src/main/python/command_executor_handler.py
+++ b/ms/command-executor/src/main/python/command_executor_handler.py
@@ -31,7 +31,7 @@ import json
REQUIREMENTS_TXT = "requirements.txt"
-class CommandExecutorHandler():
+class CommandExecutorHandler:
def __init__(self, request):
self.request = request
@@ -81,9 +81,17 @@ class CommandExecutorHandler():
payload_section = []
is_payload_section = False
+ ### extract the original header request into sys-env variables
+ ### RequestID
+ request_id = request.requestId
+ ### Sub-requestID
+ subrequest_id = request.correlationId
+ request_id_map = {'CDS_REQUEST_ID':request_id, 'CDS_CORRELATION_ID':subrequest_id}
+ updated_env = { **os.environ, **request_id_map }
+
try:
with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
- shell=True, bufsize=1, universal_newlines=True) as newProcess:
+ shell=True, bufsize=1, universal_newlines=True, env=updated_env) as newProcess:
while True:
output = newProcess.stdout.readline()
if output == '' and newProcess.poll() is not None: