ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject ambari git commit: AMBARI-8333. Ambari-agent restart fails on Ubuntu. (aonishuk)
Date Sat, 15 Nov 2014 18:26:11 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.7.0 283cbae8d -> 0e25a431b


AMBARI-8333. Ambari-agent restart fails on Ubuntu. (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0e25a431
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0e25a431
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0e25a431

Branch: refs/heads/branch-1.7.0
Commit: 0e25a431b8c840cdb6455147108289e787035271
Parents: 283cbae
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Fri Nov 14 15:08:41 2014 +0200
Committer: Mahadev Konar <mahadev@apache.org>
Committed: Sat Nov 15 10:15:56 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/0e25a431/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 5d33ca4..341df3e 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.kill(pid, signal.SIGTERM)
+    os.killpg(os.getpgid(pid), signal.SIGTERM)
     time.sleep(5)
     if os.path.exists(ProcessHelper.pidfile):
       raise Exception("PID file still exists.")
     os._exit(0)
-  except Exception, err:
+  except Exception:
     if pid == -1:
       print ("Agent process is not running")
     else:
-      os.kill(pid, signal.SIGKILL)
+      os.killpg(os.getpgid(pid), signal.SIGKILL)
     os._exit(1)
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e25a431/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 7b1a8c8..4e1a5e7 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.kill")
+  @patch("os.killpg")
   @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(int(pid), signal.SIGTERM)
+    kill_mock.assert_called_with(os.getpgid(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(int(pid), signal.SIGTERM)
-    kill_mock.assert_any_call(int(pid), signal.SIGKILL)
+    kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGTERM)
+    kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGKILL)
     _exit_mock.assert_called_with(1)
 
     # Restore


Mime
View raw message