ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnettle...@apache.org
Subject ambari git commit: AMBARI-12595. Blueprint deployments should refresh configuration on all commands. (rnettleton)
Date Mon, 03 Aug 2015 14:13:33 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 0a2df9149 -> d03bc09e4


AMBARI-12595. Blueprint deployments should refresh configuration on all commands. (rnettleton)


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

Branch: refs/heads/branch-2.1
Commit: d03bc09e41e30b4f108ad83b9b239d7bf9d140bd
Parents: 0a2df91
Author: Bob Nettleton <rnettleton@hortonworks.com>
Authored: Mon Aug 3 10:13:07 2015 -0400
Committer: Bob Nettleton <rnettleton@hortonworks.com>
Committed: Mon Aug 3 10:13:07 2015 -0400

----------------------------------------------------------------------
 .../actionmanager/ExecutionCommandWrapper.java  | 17 +++++++++++++++-
 .../AmbariManagementControllerImpl.java         | 21 +++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d03bc09e/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
index a775452..9e18fec 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
@@ -17,6 +17,7 @@
  */
 package org.apache.ambari.server.actionmanager;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -36,11 +37,13 @@ import org.apache.commons.logging.LogFactory;
 
 import com.google.inject.Inject;
 import com.google.inject.Injector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ExecutionCommandWrapper {
   @Inject
   static Injector injector;
-  private static Log LOG = LogFactory.getLog(ExecutionCommandWrapper.class);
+  private final static Logger LOG = LoggerFactory.getLogger(ExecutionCommandWrapper.class);
   private static String DELETED = "DELETED_";
   String jsonExecutionCommand = null;
   ExecutionCommand executionCommand = null;
@@ -53,6 +56,17 @@ public class ExecutionCommandWrapper {
     this.executionCommand = executionCommand;
   }
 
+  public ExecutionCommand getExecutionCommand(boolean forceRefreshAllConfig) {
+    // for Blueprint-based installs, force a refresh on the configuration
+    // prior to sending the commands down
+    if (forceRefreshAllConfig && (executionCommand != null)) {
+      executionCommand.setForceRefreshConfigTagsBeforeExecution(Collections.singleton("*"));
+    }
+
+    // delegate to main wrapper method to handle the configuration merging
+    return getExecutionCommand();
+  }
+
   @SuppressWarnings("serial")
   public ExecutionCommand getExecutionCommand() {
     if (executionCommand != null) {
@@ -92,6 +106,7 @@ public class ExecutionCommandWrapper {
                 // if forcing a refresh of *, then clear out any existing
                 // configurations so that all of the new configurations are
                 // forcefully applied
+                LOG.info("ExecutionCommandWrapper.getExecutionCommand: refreshConfigTag set
to {}, so clearing config for full refresh.", refreshConfigTag);
                 executionCommand.getConfigurations().clear();
 
                 for (final Entry<String, DesiredConfig> desiredConfig : desiredConfigs.entrySet())
{

http://git-wip-us.apache.org/repos/asf/ambari/blob/d03bc09e/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 b1149a4..a7f206a 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
@@ -1819,8 +1819,13 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     StackInfo stackInfo = ambariMetaInfo.getStack(stackId.getStackName(),
         stackId.getStackVersion());
 
+    final boolean isBlueprintInstall = isBlueprintInstall(commandParamsInp);
+    if (isBlueprintInstall) {
+      LOG.info("AmbariManagementControllerImpl.createHostAction: Blueprint install detected,
forcing refresh of all configuration types");
+    }
+
     ExecutionCommand execCmd = stage.getExecutionCommandWrapper(scHost.getHostName(),
-      scHost.getServiceComponentName()).getExecutionCommand();
+      scHost.getServiceComponentName()).getExecutionCommand(isBlueprintInstall);
 
     Host host = clusters.getHost(scHost.getHostName());
 
@@ -1836,6 +1841,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     execCmd.setConfigurations(configurations);
     execCmd.setConfigurationAttributes(configurationAttributes);
     execCmd.setConfigurationTags(configTags);
+
+
+
     // Create a local copy for each command
     Map<String, String> commandParams = new TreeMap<String, String>();
     if (commandParamsInp != null) { // if not defined
@@ -1973,6 +1981,17 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
 
     Map<String, String> roleParams = new TreeMap<String, String>();
     execCmd.setRoleParams(roleParams);
+
+    if ((execCmd != null) && (execCmd.getConfigurationTags().containsKey("cluster-env")))
{
+      LOG.info("AmbariManagementControllerImpl.createHostAction: created ExecutionCommand
for host {}, role {}, roleCommand {}, and command ID {}, with cluster-env tags {}",
+        execCmd.getHostname(), execCmd.getRole(), execCmd.getRoleCommand(), execCmd.getCommandId(),
execCmd.getConfigurationTags().get("cluster-env").get("tag"));
+    }
+  }
+
+  private static boolean isBlueprintInstall(Map<String, String> commandParams) {
+    return commandParams != null && commandParams.containsKey(CLUSTER_PHASE_PROPERTY)
&&
+      ((commandParams.get(CLUSTER_PHASE_PROPERTY).equals(CLUSTER_PHASE_INITIAL_INSTALL))
||
+        ((commandParams.get(CLUSTER_PHASE_PROPERTY).equals(CLUSTER_PHASE_INITIAL_START))));
   }
 
   /**


Mime
View raw message