You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ma...@apache.org on 2014/11/16 21:17:16 UTC
ambari git commit: Revert "AMBARI-8333. Ambari-agent restart fails on
Ubuntu. (aonishuk)"
Repository: ambari
Updated Branches:
refs/heads/branch-1.7.0 92037a7f3 -> 6db439f44
Revert "AMBARI-8333. Ambari-agent restart fails on Ubuntu. (aonishuk)"
This reverts commit 0e25a431b8c840cdb6455147108289e787035271.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6db439f4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6db439f4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6db439f4
Branch: refs/heads/branch-1.7.0
Commit: 6db439f44fda673aa7bb3f4602ed0a6ddbe2701d
Parents: 92037a7
Author: Mahadev Konar <ma...@apache.org>
Authored: Sun Nov 16 12:17:04 2014 -0800
Committer: Mahadev Konar <ma...@apache.org>
Committed: Sun Nov 16 12:17:04 2014 -0800
----------------------------------------------------------------------
ambari-agent/src/main/python/ambari_agent/main.py | 6 +++---
ambari-agent/src/test/python/ambari_agent/TestMain.py | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db439f4/ambari-agent/src/main/python/ambari_agent/main.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/main.py b/ambari-agent/src/main/python/ambari_agent/main.py
index 341df3e..5d33ca4 100644
--- a/ambari-agent/src/main/python/ambari_agent/main.py
+++ b/ambari-agent/src/main/python/ambari_agent/main.py
@@ -168,16 +168,16 @@ def stop_agent():
pid = f.read()
pid = int(pid)
f.close()
- os.killpg(os.getpgid(pid), signal.SIGTERM)
+ os.kill(pid, signal.SIGTERM)
time.sleep(5)
if os.path.exists(ProcessHelper.pidfile):
raise Exception("PID file still exists.")
os._exit(0)
- except Exception:
+ except Exception, err:
if pid == -1:
print ("Agent process is not running")
else:
- os.killpg(os.getpgid(pid), signal.SIGKILL)
+ os.kill(pid, signal.SIGKILL)
os._exit(1)
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db439f4/ambari-agent/src/test/python/ambari_agent/TestMain.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestMain.py b/ambari-agent/src/test/python/ambari_agent/TestMain.py
index 4e1a5e7..7b1a8c8 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestMain.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestMain.py
@@ -189,7 +189,7 @@ class TestMain(unittest.TestCase):
@patch("time.sleep")
- @patch("os.killpg")
+ @patch("os.kill")
@patch("os._exit")
@patch("os.path.exists")
def test_daemonize_and_stop(self, exists_mock, _exit_mock, kill_mock, sleep_mock):
@@ -207,7 +207,7 @@ class TestMain(unittest.TestCase):
# Testing normal exit
exists_mock.return_value = False
main.stop_agent()
- kill_mock.assert_called_with(os.getpgid(int(pid)), signal.SIGTERM)
+ kill_mock.assert_called_with(int(pid), signal.SIGTERM)
_exit_mock.assert_called_with(0)
# Restore
@@ -217,8 +217,8 @@ class TestMain(unittest.TestCase):
# Testing exit when failed to remove pid file
exists_mock.return_value = True
main.stop_agent()
- kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGTERM)
- kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGKILL)
+ kill_mock.assert_any_call(int(pid), signal.SIGTERM)
+ kill_mock.assert_any_call(int(pid), signal.SIGKILL)
_exit_mock.assert_called_with(1)
# Restore