Ver código fonte

AMBARI-801. Fix heartbeat message from the agent which is causing NPE at the server. (mahadev)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1393810 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 12 anos atrás
pai
commit
dfb7f03927

+ 3 - 0
AMBARI-666-CHANGES.txt

@@ -12,6 +12,9 @@ AMBARI-666 branch (unreleased changes)
 
   NEW FEATURES
 
+  AMBARI-801. Fix heartbeat message from the agent which is causing NPE at the
+  server. (mahadev)
+
   AMBARI-778. Ensure data flows across all steps in installer wizard.
   (Jaimin Jetly via yusaku)
 

+ 2 - 1
ambari-agent/src/main/python/ambari_agent/Controller.py

@@ -107,7 +107,8 @@ class Controller(threading.Thread):
       try:
         if retry==False:
           data = json.dumps(self.heartbeat.build(id))
-
+          pass
+        logger.info("Sending HeartBeat " + pprint.pformat(data))
         req = urllib2.Request(self.heartbeatUrl, data, {'Content-Type': 'application/json'})
         
         logger.info(data)

+ 6 - 2
ambari-agent/src/main/python/ambari_agent/Heartbeat.py

@@ -39,11 +39,15 @@ class Heartbeat:
     timestamp = int(time.time()*1000)
     queueResult = self.actionQueue.result()
     installedRoleStates = serverStatus.build()
+    nodeStatus = { "status" : "HEALTHY",
+                   "cause" : "NONE"}
+    
     heartbeat = { 'responseId'        : int(id),
                   'timestamp'         : timestamp,
                   'hostname'          : socket.gethostname(),
-                  'reports'           : self.reports,
-                  'componentStatus'   : self.componentStatus
+                 # 'reports'           : self.reports,
+                 # 'componentStatus'   : self.componentStatus,
+                  'nodeStatus'        : nodeStatus
                 }
   
     

+ 7 - 1
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java

@@ -21,8 +21,13 @@ import java.util.List;
 
 import org.apache.ambari.server.agent.ActionQueue;
 import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.agent.rest.AgentResource;
 import org.apache.ambari.server.state.live.Clusters;
 import org.apache.ambari.server.utils.StageUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
@@ -38,7 +43,8 @@ public class ActionManager {
   private final ActionDBAccessor db;
   private final ActionQueue actionQueue;
   private final Clusters fsm;
-
+  private static Logger LOG = LoggerFactory.getLogger(ActionManager.class);
+  
   @Inject
   public ActionManager(@Named("schedulerSleeptime") long schedulerSleepTime,
       @Named("actionTimeout") long actionTimeout,