Browse Source

AMBARI-2007. Decom DataNode throws JS error. (smohanty)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1471186 13f79535-47bb-0310-9956-ffa450edef68
Sumit Mohanty 12 năm trước cách đây
mục cha
commit
a3c2536bcc

+ 2 - 0
CHANGES.txt

@@ -774,6 +774,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2007. Decom DataNode throws JS error. (smohanty)
+
  AMBARI-1994. Adding component to Host should should wire-up + adjust
  associated Nagios alerts. (smohanty)
 

+ 10 - 7
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java

@@ -4086,11 +4086,15 @@ public class AmbariManagementControllerImpl implements
     String clusterName = null;
 
     String requestContext = "";
-    
-    if (requestProperties != null)
+
+    if (requestProperties != null) {
       requestContext = requestProperties.get(REQUEST_CONTEXT_PROPERTY);
-      
-    
+      if (requestContext == null) {
+        // guice needs a non-null value as there is no way to mark this parameter @Nullable
+        requestContext = "";
+      }
+    }
+
     String logDir = ""; //TODO empty for now
 
     for (ActionRequest actionRequest : request) {
@@ -4110,10 +4114,10 @@ public class AmbariManagementControllerImpl implements
         throw new AmbariException("Requests for different clusters found");
       }
     }
-    
+
     Stage stage = stageFactory.createNew(actionManager.getNextRequestId(),
         logDir, clusterName, requestContext);
-    
+
     stage.setStageId(0);
     for (ActionRequest actionRequest : request) {
       if (actionRequest.getActionName().contains("SERVICE_CHECK")) {
@@ -4135,7 +4139,6 @@ public class AmbariManagementControllerImpl implements
     }
   }
 
-
   @Override
   public Set<StackResponse> getStacks(Set<StackRequest> requests)
       throws AmbariException {

+ 5 - 2
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java

@@ -3486,8 +3486,6 @@ public class AmbariManagementControllerTest {
     assertEquals(requestProperties.get(REQUEST_CONTEXT_PROPERTY), stage.getRequestContext());
     actionRequests.add(new ActionRequest("c1", "MAPREDUCE", Role.MAPREDUCE_SERVICE_CHECK.name(), null));
 
-
-
     response = controller.createActions(actionRequests, requestProperties);
 
     assertEquals(2, response.getTasks().size());
@@ -3495,6 +3493,11 @@ public class AmbariManagementControllerTest {
     List<HostRoleCommand> tasks = actionDB.getRequestTasks(response.getRequestId());
 
     assertEquals(2, tasks.size());
+
+    requestProperties.put(REQUEST_CONTEXT_PROPERTY, null);
+    response = controller.createActions(actionRequests, requestProperties);
+
+    assertEquals(2, response.getTasks().size());
   }
 
   private void createUser(String userName) throws Exception {