aboutsummaryrefslogtreecommitdiffstats
path: root/ms/command-executor
diff options
context:
space:
mode:
authorSerge Simard <serge@agilitae.com>2019-06-25 17:20:48 -0400
committerSerge Simard <serge@agilitae.com>2019-06-25 17:22:13 -0400
commit844b26eaf9fa4010f0457fd0ed782dac37e09517 (patch)
treebe424d136b8c74219628b2a8e00475b4484a442c /ms/command-executor
parenta6fae85764a8dfbeba6000a060b8be0f21fb0466 (diff)
Remote Python executor Handler class process fails with Arguments list too long
Issue-ID: CCSDK-1435 Change-Id: I02b1d8393c2506850cf37df6e3447d195f4fabb5 Signed-off-by: Serge Simard <serge@agilitae.com>
Diffstat (limited to 'ms/command-executor')
-rw-r--r--ms/command-executor/src/main/python/command_executor_handler.py7
1 files changed, 7 insertions, 0 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 365c00188..305c83e17 100644
--- a/ms/command-executor/src/main/python/command_executor_handler.py
+++ b/ms/command-executor/src/main/python/command_executor_handler.py
@@ -163,9 +163,16 @@ class CommandExecutorHandler():
def activate_venv(self):
self.logger.info("{} - Activate Python Virtual Environment".format(self.blueprint_id))
+ # Fix: The python generated activate_this.py script concatenates the env bin dir to PATH on every call
+ # eventually this process PATH variable was so big (128Kb) that no child process could be spawn
+ # This script will remove all duplicates; while keeping the order of the PATH folders
+ fixpathenvvar = "os.environ['PATH']=os.pathsep.join(list(dict.fromkeys(os.environ['PATH'].split(':'))))"
+
path = "%s/bin/activate_this.py" % self.venv_home
try:
exec (open(path).read(), {'__file__': path})
+ exec (fixpathenvvar)
+ self.logger.info("Running with PATH : {}".format(os.environ['PATH']))
return True
except Exception as err:
self.logger.info(