You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ch...@apache.org on 2015/05/14 15:15:26 UTC
stratos git commit: PCA - Fix env variables not being passed to
extensions
Repository: stratos
Updated Branches:
refs/heads/master 23278fbee -> 3c880b65e
PCA - Fix env variables not being passed to extensions
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/3c880b65
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/3c880b65
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/3c880b65
Branch: refs/heads/master
Commit: 3c880b65e399422d4c5009662aa0c11cf5cd45ea
Parents: 23278fb
Author: Chamila de Alwis <ch...@apache.org>
Authored: Thu May 14 18:44:59 2015 +0530
Committer: Chamila de Alwis <ch...@apache.org>
Committed: Thu May 14 18:45:08 2015 +0530
----------------------------------------------------------------------
.../cartridge.agent/extensions/py/ExtensionExecutor.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/3c880b65/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
index fbd315b..afb4f8e 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
@@ -33,7 +33,7 @@ class ExtensionExecutor(ICartridgeAgentPlugin):
# log.debug("%s => %s" % ("STRATOS_" + key, extension_values["STRATOS_" + key]))
try:
- output, errors = ExtensionExecutor.execute_script(event_name + ".sh")
+ output, errors = ExtensionExecutor.execute_script(event_name + ".sh", extension_values)
except OSError:
raise RuntimeError("Could not find an extension file for event %s" % event_name)
@@ -43,14 +43,15 @@ class ExtensionExecutor(ICartridgeAgentPlugin):
log.info("%s Extension executed. [output]: %s" % (event_name, output))
@staticmethod
- def execute_script(bash_file):
+ def execute_script(bash_file, extension_values):
""" Execute the given bash files in the <PCA_HOME>/extensions/bash folder
:param bash_file: name of the bash file to execute
:return: tuple of (output, errors)
"""
working_dir = os.path.abspath(os.path.dirname(__file__)).split("modules")[0]
command = working_dir[:-2] + "bash/" + bash_file
- extension_values = os.environ.copy()
+ current_env_vars = os.environ.copy()
+ extension_values.update(current_env_vars)
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=extension_values)
output, errors = p.communicate()