ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [29/37] ambari git commit: AMBARI-22689. Restart agent command sent by server (Xianghao Lu via adoroszlai)
Date Tue, 02 Jan 2018 16:56:20 GMT
AMBARI-22689. Restart agent command sent by server (Xianghao Lu via adoroszlai)


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

Branch: refs/heads/branch-feature-AMBARI-21674
Commit: e0b085afdbcfd85e80be314a7effdb562a52951a
Parents: 6db30d8
Author: Xianghao Lu <luxianghao3@gmail.com>
Authored: Sun Dec 31 23:34:01 2017 +0100
Committer: Doroszlai, Attila <adoroszlai@hortonworks.com>
Committed: Sun Dec 31 23:34:01 2017 +0100

----------------------------------------------------------------------
 ambari-agent/src/main/python/ambari_agent/Controller.py      | 2 +-
 ambari-agent/src/test/python/ambari_agent/TestController.py  | 8 ++++----
 .../test/python/ambari_agent/examples/ControllerTester.py    | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e0b085af/ambari-agent/src/main/python/ambari_agent/Controller.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Controller.py b/ambari-agent/src/main/python/ambari_agent/Controller.py
index e4f148f..6862cbb 100644
--- a/ambari-agent/src/main/python/ambari_agent/Controller.py
+++ b/ambari-agent/src/main/python/ambari_agent/Controller.py
@@ -418,7 +418,7 @@ class Controller(threading.Thread):
           logger.log(logging_level, "Executing alert commands")
           self.alert_scheduler_handler.execute_alert(response['alertExecutionCommands'])
 
-        if "true" == response['restartAgent']:
+        if response['restartAgent']:
           logger.error("Received the restartAgent command")
           self.restartAgent()
         else:

http://git-wip-us.apache.org/repos/asf/ambari/blob/e0b085af/ambari-agent/src/test/python/ambari_agent/TestController.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestController.py b/ambari-agent/src/test/python/ambari_agent/TestController.py
index 20da81f..cb69e5d 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestController.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestController.py
@@ -447,7 +447,7 @@ class TestController(unittest.TestCase):
     self.controller.sendRequest = sendRequest
 
     self.controller.responseId = 1
-    response = {"responseId":"2", "restartAgent":"false"}
+    response = {"responseId":"2", "restartAgent":False}
     sendRequest.return_value = response
 
     def one_heartbeat(*args, **kwargs):
@@ -521,7 +521,7 @@ class TestController(unittest.TestCase):
 
     # wrong responseId => restart
     self.controller.responseId = 2
-    response = {"responseId":"2", "restartAgent":"false"}
+    response = {"responseId":"2", "restartAgent":False}
 
     restartAgent = MagicMock(name="restartAgent")
     self.controller.restartAgent = restartAgent
@@ -553,7 +553,7 @@ class TestController(unittest.TestCase):
     # restartAgent command
     self.controller.responseId = 1
     self.controller.DEBUG_STOP_HEARTBEATING = False
-    response["restartAgent"] = "true"
+    response["restartAgent"] = True
     restartAgent = MagicMock(name="restartAgent")
     self.controller.restartAgent = restartAgent
     self.controller.heartbeatWithServer()
@@ -564,7 +564,7 @@ class TestController(unittest.TestCase):
     self.controller.responseId = 1
     self.controller.DEBUG_STOP_HEARTBEATING = False
     actionQueue.isIdle.return_value = False
-    response["restartAgent"] = "false"
+    response["restartAgent"] = False
     self.controller.heartbeatWithServer()
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e0b085af/ambari-agent/src/test/python/ambari_agent/examples/ControllerTester.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/examples/ControllerTester.py b/ambari-agent/src/test/python/ambari_agent/examples/ControllerTester.py
index bc46ac6..4a6e781 100644
--- a/ambari-agent/src/test/python/ambari_agent/examples/ControllerTester.py
+++ b/ambari-agent/src/test/python/ambari_agent/examples/ControllerTester.py
@@ -47,7 +47,7 @@ responces = [
   """
   {
     "responseId":"n",
-    "restartAgent": "False",
+    "restartAgent": false,
     "executionCommands":
       [{
         "commandId": "31-1",
@@ -89,7 +89,7 @@ responces = [
   """
   {
     "responseId":"n",
-    "restartAgent": "False",
+    "restartAgent": false,
     "executionCommands": [],
     "statusCommands":[]
   }
@@ -183,7 +183,7 @@ if __name__ == '__main__':
 #  s =   """
 #  {
 #    "responseId":"n",
-#    "restartAgent": "False",
+#    "restartAgent": false,
 #    "executionCommands":
 #      [{
 #        "commandId": "31-1",


Mime
View raw message