ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [04/29] ambari git commit: AMBARI-21356 After decommission of a Nodemanager, the state of the Nodemanager shows "Decommissioning" instead of decommissioned (dgrinenko)
Date Fri, 07 Jul 2017 14:49:18 GMT
AMBARI-21356 After decommission of a Nodemanager, the state of the Nodemanager shows "Decommissioning"
instead of decommissioned (dgrinenko)


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

Branch: refs/heads/branch-feature-AMBARI-21348
Commit: e27772edb0a627315e5cac30a7a66640526001b3
Parents: b4e1c88
Author: Dmytro Grinenko <hapylestat@apache.org>
Authored: Tue Jun 27 19:31:15 2017 +0300
Committer: Dmytro Grinenko <hapylestat@apache.org>
Committed: Tue Jun 27 19:31:15 2017 +0300

----------------------------------------------------------------------
 .../AmbariCustomCommandExecutionHelper.java      | 19 ++++++-------------
 .../AmbariManagementControllerImpl.java          |  2 +-
 .../server/controller/ExecuteCommandJson.java    |  4 ++++
 .../server/controller/KerberosHelperImpl.java    |  8 ++++----
 .../internal/UpgradeResourceProvider.java        |  4 ++--
 .../AmbariCustomCommandExecutionHelperTest.java  |  6 +++---
 6 files changed, 20 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e27772ed/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 6e75ab6..71387e1 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
@@ -75,12 +75,10 @@ import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.metadata.ActionMetadata;
 import org.apache.ambari.server.orm.dao.ClusterVersionDAO;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
-import org.apache.ambari.server.orm.dao.RequestDAO;
 import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
 import org.apache.ambari.server.orm.entities.OperatingSystemEntity;
 import org.apache.ambari.server.orm.entities.RepositoryEntity;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
-import org.apache.ambari.server.orm.entities.RequestEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.CommandScriptDefinition;
@@ -176,9 +174,6 @@ public class AmbariCustomCommandExecutionHelper {
   private ClusterVersionDAO clusterVersionDAO;
 
   @Inject
-  private RequestDAO requestDAO;
-
-  @Inject
   private HostRoleCommandDAO hostRoleCommandDAO;
 
   private Map<String, Map<String, Map<String, String>>> configCredentialsForService
= new HashMap<>();
@@ -813,7 +808,7 @@ public class AmbariCustomCommandExecutionHelper {
    * calls into the implementation of a custom command
    */
   private void addDecommissionAction(final ActionExecutionContext actionExecutionContext,
-      final RequestResourceFilter resourceFilter, Stage stage) throws AmbariException {
+      final RequestResourceFilter resourceFilter, Stage stage, ExecuteCommandJson executeCommandJson)
throws AmbariException {
 
     String clusterName = actionExecutionContext.getClusterName();
     final Cluster cluster = clusters.getCluster(clusterName);
@@ -1008,11 +1003,8 @@ public class AmbariCustomCommandExecutionHelper {
           StageUtils.getClusterHostInfo(cluster));
 
       // Reset cluster host info as it has changed
-      RequestEntity requestEntity = requestDAO.findByPK(stage.getRequestId());
-
-      if (requestEntity != null) {
-        requestEntity.setClusterHostInfo(clusterHostInfoJson);
-        requestDAO.merge(requestEntity);
+      if (executeCommandJson != null) {
+        executeCommandJson.setClusterHostInfo(clusterHostInfoJson);
       }
 
       Map<String, String> commandParams = new HashMap<>();
@@ -1090,11 +1082,12 @@ public class AmbariCustomCommandExecutionHelper {
    * @param actionExecutionContext  received request to execute a command
    * @param stage                   the initial stage for task creation
    * @param requestParams           the request params
+   * @param executeCommandJson      set of json arguments passed to the request
    *
    * @throws AmbariException if the commands can not be added
    */
   public void addExecutionCommandsToStage(ActionExecutionContext actionExecutionContext,
-      Stage stage, Map<String, String> requestParams) throws AmbariException {
+      Stage stage, Map<String, String> requestParams, ExecuteCommandJson executeCommandJson)
throws AmbariException {
 
     List<RequestResourceFilter> resourceFilters = actionExecutionContext.getResourceFilters();
 
@@ -1108,7 +1101,7 @@ public class AmbariCustomCommandExecutionHelper {
       if (actionName.contains(SERVICE_CHECK_COMMAND_NAME)) {
         findHostAndAddServiceCheckAction(actionExecutionContext, resourceFilter, stage);
       } else if (actionName.equals(DECOMMISSION_COMMAND_NAME)) {
-        addDecommissionAction(actionExecutionContext, resourceFilter, stage);
+        addDecommissionAction(actionExecutionContext, resourceFilter, stage, executeCommandJson);
       } else if (isValidCustomCommand(actionExecutionContext, resourceFilter)) {
 
         String commandDetail = getReadableCustomCommandDetail(actionExecutionContext, resourceFilter);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e27772ed/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 827c785..82171f6 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
@@ -4173,7 +4173,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
 
     if (actionRequest.isCommand()) {
       customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage,
-          requestProperties);
+          requestProperties, jsons);
     } else {
       actionExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage, requestProperties);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e27772ed/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteCommandJson.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteCommandJson.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteCommandJson.java
index e3f87d9..8148576 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteCommandJson.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteCommandJson.java
@@ -53,4 +53,8 @@ public class ExecuteCommandJson {
     return clusterHostJson;
   }
 
+  public void setClusterHostInfo(String clusterHostJson){
+    this.clusterHostJson = clusterHostJson;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e27772ed/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index e4b70fd..9c65aa6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -2974,7 +2974,7 @@ public class KerberosHelperImpl implements KerberosHelper {
             requestResourceFilters,
             requestParams);
         customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage,
-            requestParams);
+            requestParams, null);
       }
 
       RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
@@ -3042,7 +3042,7 @@ public class KerberosHelperImpl implements KerberosHelper {
                 "DISABLE_SECURITY",
                 singletonList(new RequestResourceFilter(service.getName(), component.getName(),
singletonList(firstHost))),
                 Collections.<String, String>emptyMap());
-              customCommandExecutionHelper.addExecutionCommandsToStage(exec, stage, Collections.<String,
String>emptyMap());
+              customCommandExecutionHelper.addExecutionCommandsToStage(exec, stage, Collections.<String,
String>emptyMap(), null);
           }
         }
       }
@@ -3075,7 +3075,7 @@ public class KerberosHelperImpl implements KerberosHelper {
             "STOP",
             singletonList(new RequestResourceFilter(zookeeper.getName(), component.getName(),
new ArrayList<>(hosts))),
             Collections.<String, String>emptyMap());
-          customCommandExecutionHelper.addExecutionCommandsToStage(exec, stage, Collections.<String,
String>emptyMap());
+          customCommandExecutionHelper.addExecutionCommandsToStage(exec, stage, Collections.<String,
String>emptyMap(), null);
       }
       RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
       roleGraph.build(stage);
@@ -3117,7 +3117,7 @@ public class KerberosHelperImpl implements KerberosHelper {
               requestResourceFilters,
               requestParams);
           customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage,
-              requestParams);
+              requestParams, null);
         }
       }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e27772ed/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index dd0086a..2159a65 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -1427,7 +1427,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
       requestParams.put(KeyNames.COMMAND_RETRY_ENABLED, Boolean.TRUE.toString().toLowerCase());
     }
 
-    s_commandExecutionHelper.get().addExecutionCommandsToStage(actionContext, stage, requestParams);
+    s_commandExecutionHelper.get().addExecutionCommandsToStage(actionContext, stage, requestParams,
jsons);
 
     request.addStages(Collections.singletonList(stage));
   }
@@ -1480,7 +1480,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
     entity.setStageId(Long.valueOf(stageId));
 
     Map<String, String> requestParams = getNewParameterMap(request, context);
-    s_commandExecutionHelper.get().addExecutionCommandsToStage(actionContext, stage, requestParams);
+    s_commandExecutionHelper.get().addExecutionCommandsToStage(actionContext, stage, requestParams,
jsons);
 
     request.addStages(Collections.singletonList(stage));
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e27772ed/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
index 19a925a..79ae063 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
@@ -439,7 +439,7 @@ public class AmbariCustomCommandExecutionHelperTest {
     ActionExecutionContext actionExecutionContext = new ActionExecutionContext("c1", "SERVICE_CHECK",
requestResourceFilter);
     Stage stage = EasyMock.niceMock(Stage.class);
 
-    ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext,
stage, new HashMap<String, String>());
+    ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext,
stage, new HashMap<String, String>(), null);
 
     Assert.fail("Expected an exception since there are no hosts which can run the Flume service
check");
   }
@@ -474,7 +474,7 @@ public class AmbariCustomCommandExecutionHelperTest {
     EasyMock.expect(execCmd.getLocalComponents()).andReturn(localComponents).anyTimes();
     EasyMock.replay(configHelper,stage, execCmdWrapper, execCmd);
 
-    ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext,
stage, new HashMap<String, String>());
+    ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext,
stage, new HashMap<String, String>(), null);
     Map<String, String> configMap = timeOutCapture.getValues().get(0);
     for (Map.Entry<String, String> config : configMap.entrySet()) {
       if (config.getKey().equals(ExecutionCommand.KeyNames.COMMAND_TIMEOUT)) {
@@ -524,7 +524,7 @@ public class AmbariCustomCommandExecutionHelperTest {
     EasyMock.expect(execCmd.getLocalComponents()).andReturn(localComponents).anyTimes();
     EasyMock.replay(stage, execCmdWrapper, execCmd);
 
-    ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext,
stage, new HashMap<String, String>());
+    ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext,
stage, new HashMap<String, String>(), null);
   }
 
   @Test


Mime
View raw message