You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2018/02/12 12:06:07 UTC
[ambari] branch trunk updated: AMBARI-22960. Ambari agent kills
parent process on stop. (mpapirkovskyy)
This is an automated email from the ASF dual-hosted git repository.
aonishuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new 413d3d9 AMBARI-22960. Ambari agent kills parent process on stop. (mpapirkovskyy)
413d3d9 is described below
commit 413d3d960ec5101abfaf1023e13337399a3240bf
Author: Myroslav Papirkovskyi <mp...@apache.org>
AuthorDate: Wed Feb 7 16:01:10 2018 +0200
AMBARI-22960. Ambari agent kills parent process on stop. (mpapirkovskyy)
---
.../src/main/python/ambari_agent/AmbariAgent.py | 17 +++++++----------
.../src/test/python/ambari_agent/TestAmbariAgent.py | 4 +---
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/ambari-agent/src/main/python/ambari_agent/AmbariAgent.py b/ambari-agent/src/main/python/ambari_agent/AmbariAgent.py
index d8b5d81..ef38491 100644
--- a/ambari-agent/src/main/python/ambari_agent/AmbariAgent.py
+++ b/ambari-agent/src/main/python/ambari_agent/AmbariAgent.py
@@ -49,15 +49,12 @@ def main():
mergedArgs = [PYTHON, AGENT_SCRIPT] + args
- try:
- while status == AGENT_AUTO_RESTART_EXIT_CODE:
- mainProcess = subprocess32.Popen(mergedArgs)
- mainProcess.communicate()
- status = mainProcess.returncode
- if os.path.isfile(AGENT_PID_FILE) and status == AGENT_AUTO_RESTART_EXIT_CODE:
- os.remove(AGENT_PID_FILE)
- finally:
- os.killpg(0, signal.SIGKILL)
+ while status == AGENT_AUTO_RESTART_EXIT_CODE:
+ mainProcess = subprocess32.Popen(mergedArgs)
+ mainProcess.communicate()
+ status = mainProcess.returncode
+ if os.path.isfile(AGENT_PID_FILE) and status == AGENT_AUTO_RESTART_EXIT_CODE:
+ os.remove(AGENT_PID_FILE)
if __name__ == "__main__":
- main()
\ No newline at end of file
+ main()
diff --git a/ambari-agent/src/test/python/ambari_agent/TestAmbariAgent.py b/ambari-agent/src/test/python/ambari_agent/TestAmbariAgent.py
index 6eadb44..284b912 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestAmbariAgent.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestAmbariAgent.py
@@ -34,8 +34,7 @@ class TestAmbariAgent(unittest.TestCase):
@patch.object(subprocess32, "Popen")
@patch("os.path.isfile")
@patch("os.remove")
- @patch("os.killpg")
- def test_main(self, os_killpg_mock, os_remove_mock,
+ def test_main(self, os_remove_mock,
os_path_isfile_mock, subprocess32_popen_mock):
facter1 = MagicMock()
facter2 = MagicMock()
@@ -55,7 +54,6 @@ class TestAmbariAgent(unittest.TestCase):
self.assertTrue(os_path_isfile_mock.called)
self.assertTrue(os_path_isfile_mock.call_count == 2)
self.assertTrue(os_remove_mock.called)
- self.assertTrue(os_killpg_mock.called)
#
# Test AmbariConfig.getLogFile() for ambari-agent
--
To stop receiving notification emails like this one, please contact
aonishuk@apache.org.