ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [02/35] ambari git commit: AMBARI-21109. After decommission of a Nodemanager, the state of the Nodemanager shows "Decommissioning" instead of decommissioned (dgrinenko via echekanskiy)
Date Thu, 25 May 2017 17:24:12 GMT
AMBARI-21109. After decommission of a Nodemanager, the state of the Nodemanager shows "Decommissioning"
instead of decommissioned (dgrinenko via echekanskiy)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: ff0c5253e9554af52517303a5775e16d7836a246
Parents: 7bb2aba
Author: Eugene Chekanskiy <echekanskiy@hortonworks.com>
Authored: Wed May 24 20:34:51 2017 +0300
Committer: Eugene Chekanskiy <echekanskiy@hortonworks.com>
Committed: Wed May 24 20:34:51 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/ff0c5253/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 520dcab..8cefc9f 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;
@@ -178,9 +176,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<>();
@@ -824,7 +819,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);
@@ -1019,11 +1014,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<>();
@@ -1101,11 +1093,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();
 
@@ -1119,7 +1112,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/ff0c5253/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 9bc7f4a..9660488 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
@@ -4039,7 +4039,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/ff0c5253/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/ff0c5253/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 5c4728a..6a403c6 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
@@ -2958,7 +2958,7 @@ public class KerberosHelperImpl implements KerberosHelper {
             requestResourceFilters,
             requestParams);
         customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage,
-            requestParams);
+            requestParams, null);
       }
 
       RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
@@ -3026,7 +3026,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);
           }
         }
       }
@@ -3059,7 +3059,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);
@@ -3101,7 +3101,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/ff0c5253/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 0ebf3aa..fdc7928 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
@@ -1476,7 +1476,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));
   }
@@ -1529,7 +1529,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/ff0c5253/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 71a02f5..a7aa20e 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
@@ -423,7 +423,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");
   }
@@ -458,7 +458,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)) {
@@ -508,7 +508,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);
   }
 
   @Test


Mime
View raw message