Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 7f988970f -> 83bdc2736


AMBARI-21629 Update Include and Exclude Files for [HDFS]/Refreshnodes is called 
even if manage.include.files is set to false (dsen)


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

Branch: refs/heads/branch-2.5
Commit: 83bdc2736d697c4ca898a2eb4c175201977fe074
Parents: 7f98897
Author: Dmytro Sen <d...@apache.org>
Authored: Tue Aug 8 18:38:31 2017 +0300
Committer: Dmytro Sen <d...@apache.org>
Committed: Tue Aug 8 18:38:31 2017 +0300

----------------------------------------------------------------------
 .../controller/AmbariCustomCommandExecutionHelper.java   | 11 ++++++++---
 .../controller/AmbariManagementControllerImpl.java       |  4 ++--
 .../controller/AmbariManagementControllerTest.java       |  4 ++--
 3 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/83bdc273/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index ee423e2..7427a73 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -140,7 +140,7 @@ public class AmbariCustomCommandExecutionHelper {
   public final static String DECOM_SLAVE_COMPONENT = "slave_type";
   public final static String HBASE_MARK_DRAINING_ONLY = "mark_draining_only";
   public final static String UPDATE_FILES_ONLY = "update_files_only";
-  public final static String MULTI_SERVICES_DECOM_REQUEST = 
"multi_services_decom_request";
+  public final static String IS_ADD_OR_DELETE_SLAVE_REQUEST = 
"is_add_or_delete_slave_request";
 
   private final static String ALIGN_MAINTENANCE_STATE = 
"align_maintenance_state";
 
@@ -816,8 +816,8 @@ public class AmbariCustomCommandExecutionHelper {
     Set<String> includedHosts = 
getHostList(actionExecutionContext.getParameters(),
                                             DECOM_INCLUDED_HOSTS);
 
-    if 
(actionExecutionContext.getParameters().get(MULTI_SERVICES_DECOM_REQUEST) != 
null &&
-            
actionExecutionContext.getParameters().get(MULTI_SERVICES_DECOM_REQUEST).equalsIgnoreCase("true"))
 {
+    if 
(actionExecutionContext.getParameters().get(IS_ADD_OR_DELETE_SLAVE_REQUEST) != 
null &&
+            
actionExecutionContext.getParameters().get(IS_ADD_OR_DELETE_SLAVE_REQUEST).equalsIgnoreCase("true"))
 {
       includedHosts = getHostList(actionExecutionContext.getParameters(), 
masterCompType + "_" + DECOM_INCLUDED_HOSTS);
     }
 
@@ -1025,6 +1025,11 @@ public class AmbariCustomCommandExecutionHelper {
       List<String> listOfExcludedHosts) {
     StringBuilder commandDetail = new StringBuilder();
     commandDetail.append(actionExecutionContext.getActionName());
+    if 
(actionExecutionContext.getParameters().containsKey(IS_ADD_OR_DELETE_SLAVE_REQUEST)
 &&
+      
actionExecutionContext.getParameters().get(IS_ADD_OR_DELETE_SLAVE_REQUEST).equalsIgnoreCase("true"))
 {
+      commandDetail.append(", Update Include/Exclude Files");
+      return commandDetail;
+    }
     if (listOfExcludedHosts.size() > 0) {
       commandDetail.append(", Excluded: 
").append(StringUtils.join(listOfExcludedHosts, ','));
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/83bdc273/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index f557472..36b69b5 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -3739,7 +3739,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
     }
     LOG.debug("Refresh include/exclude files action will be executed for " + 
serviceMasterMap);
     HashMap<String, String> requestProperties = new HashMap<>();
-    requestProperties.put("context", "Update Include and Exclude Files for " + 
serviceMasterMap.keySet().toString());
+    requestProperties.put("context", "Update Include/Exclude Files for " + 
serviceMasterMap.keySet().toString());
     requestProperties.put("exclusive", "true");
     HashMap<String, String> params = new HashMap<>();
     params.put(AmbariCustomCommandExecutionHelper.UPDATE_FILES_ONLY, 
String.valueOf(isDecommission));
@@ -3750,7 +3750,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
       }
     }
 
-    
params.put(AmbariCustomCommandExecutionHelper.MULTI_SERVICES_DECOM_REQUEST, 
"true");
+    
params.put(AmbariCustomCommandExecutionHelper.IS_ADD_OR_DELETE_SLAVE_REQUEST, 
"true");
 
     //Create filter for command
     List<RequestResourceFilter> resourceFilters = new 
ArrayList<>(serviceMasterMap.size());

http://git-wip-us.apache.org/repos/asf/ambari/blob/83bdc273/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 6b34473..87d271a 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -10224,11 +10224,11 @@ public class AmbariManagementControllerTest {
 
     List<Long> requestIDs = actionDB.getRequestsByStatus(null, 1, false);
     Request request = actionDB.getRequest(requestIDs.get(0));
-    assertEquals("Update Include and Exclude Files for [HDFS]", 
request.getRequestContext());
+    assertEquals("Update Include/Exclude Files for [HDFS]", 
request.getRequestContext());
     Type type = new TypeToken<Map<String, String>>(){}.getType();
     Map<String, String> requestParams = 
StageUtils.getGson().fromJson(request.getInputs(), type);
     assertEquals(2, requestParams.size());
-    assertEquals("true", requestParams.get("multi_services_decom_request"));
+    assertEquals("true", requestParams.get("is_add_or_delete_slave_request"));
     assertEquals("true", requestParams.get("update_files_only"));
     assertEquals(1, request.getResourceFilters().size());
     RequestResourceFilter resourceFilter = request.getResourceFilters().get(0);

Reply via email to