ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From magyari_san...@apache.org
Subject ambari git commit: AMBARI-17402. Add new configuration property to enable skipping of INSTALL tasks for Blueprint deployments (magyari_sandor)
Date Thu, 23 Jun 2016 14:51:11 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 80abd6ca6 -> 5e11d0366


AMBARI-17402. Add new configuration property to enable skipping of INSTALL tasks for Blueprint
deployments (magyari_sandor)


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

Branch: refs/heads/trunk
Commit: 5e11d0366747182987825ab5bfb3e68d5e2807d9
Parents: 80abd6c
Author: Sandor Magyari <smagyari@hortonworks.com>
Authored: Thu Jun 23 14:06:51 2016 +0200
Committer: Sandor Magyari <smagyari@hortonworks.com>
Committed: Thu Jun 23 16:50:36 2016 +0200

----------------------------------------------------------------------
 .../apache/ambari/server/configuration/Configuration.java   | 9 +++++++++
 .../server/controller/AmbariManagementControllerImpl.java   | 4 +---
 .../org/apache/ambari/server/topology/AmbariContext.java    | 4 ++--
 .../java/org/apache/ambari/server/topology/HostRequest.java | 6 +-----
 .../topology/ClusterDeployWithHostsSyspreppedTest.java      | 2 +-
 .../server/topology/ClusterInstallWithoutStartTest.java     | 2 +-
 6 files changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5e11d036/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index d736303..2eb0734 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -492,6 +492,9 @@ public class Configuration {
   public static final String SYS_PREPPED_HOSTS_KEY = "packages.pre.installed";
   public static final String SYS_PREPPED_HOSTS_DEFAULT = "false";
 
+  public static final String BLUEPRINT_SKIP_INSTALL_TASKS_KEY = "blueprint.skip_install_tasks";
+  public static final String BLUEPRINT_SKIP_INSTALL_TASKS_DEFAULT = "false";
+
   /**
    * !!! TODO: For embedded server only - should be removed later
    */
@@ -1290,6 +1293,12 @@ public class Configuration {
     return properties.getProperty(SYS_PREPPED_HOSTS_KEY, SYS_PREPPED_HOSTS_DEFAULT);
   }
 
+  public boolean skipInstallTasks(){
+    String skipInstallCommandsProperty = properties.getProperty
+      (BLUEPRINT_SKIP_INSTALL_TASKS_KEY, BLUEPRINT_SKIP_INSTALL_TASKS_DEFAULT);
+    return Boolean.parseBoolean(areHostsSysPrepped()) && Boolean.parseBoolean(skipInstallCommandsProperty);
+  }
+
   public String getStackAdvisorScript() {
     return properties.getProperty(STACK_ADVISOR_SCRIPT, STACK_ADVISOR_SCRIPT_DEFAULT);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5e11d036/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 349668f..9f82a90 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
@@ -138,7 +138,6 @@ import org.apache.ambari.server.security.ldap.LdapSyncDto;
 import org.apache.ambari.server.serveraction.kerberos.KerberosInvalidConfigurationException;
 import org.apache.ambari.server.serveraction.kerberos.KerberosOperationException;
 import org.apache.ambari.server.stack.ExtensionHelper;
-import org.apache.ambari.server.stack.StackManager;
 import org.apache.ambari.server.stageplanner.RoleGraph;
 import org.apache.ambari.server.stageplanner.RoleGraphFactory;
 import org.apache.ambari.server.state.Cluster;
@@ -177,7 +176,6 @@ import org.apache.ambari.server.state.configgroup.ConfigGroupFactory;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
 import org.apache.ambari.server.state.scheduler.RequestExecutionFactory;
 import org.apache.ambari.server.state.stack.RepositoryXml;
-import org.apache.ambari.server.state.stack.ServiceMetainfoXml;
 import org.apache.ambari.server.state.stack.WidgetLayout;
 import org.apache.ambari.server.state.stack.WidgetLayoutInfo;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent;
@@ -2692,7 +2690,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
 
             // Skip INSTALL task in case SysPrepped hosts and in case of server components.
In case of server component
             // START task should run configuration script.
-            if (Boolean.parseBoolean(configs.areHostsSysPrepped()) &&
+            if (configs.skipInstallTasks() &&
                   "INITIAL_INSTALL".equals(requestProperties.get("phase")) &&
                     newState == State.INSTALLED && !isClientComponent(cluster, scHost))
{
               LOG.info("Skipping create of INSTALL task for {} on {} because host is sysprepped.",
scHost

http://git-wip-us.apache.org/repos/asf/ambari/blob/5e11d036/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
index b6809f0..926d253 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
@@ -117,8 +117,8 @@ public class AmbariContext {
     return cluster.getSecurityType() == SecurityType.KERBEROS;
   }
 
-  public boolean areHostsSysPrepped() {
-    return Boolean.parseBoolean(configs.areHostsSysPrepped());
+  public boolean shouldSkipInstallTasks() {
+    return configs.skipInstallTasks();
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/5e11d036/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
index d001f54..a9c26cc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
@@ -19,7 +19,6 @@
 package org.apache.ambari.server.topology;
 
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
-import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.api.predicate.InvalidQueryException;
 import org.apache.ambari.server.api.predicate.PredicateCompiler;
 import org.apache.ambari.server.controller.RequestStatusResponse;
@@ -33,9 +32,6 @@ import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
 import org.apache.ambari.server.orm.entities.TopologyHostRequestEntity;
 import org.apache.ambari.server.orm.entities.TopologyHostTaskEntity;
 import org.apache.ambari.server.orm.entities.TopologyLogicalTaskEntity;
-import org.apache.ambari.server.state.AutoDeployInfo;
-import org.apache.ambari.server.state.ComponentInfo;
-import org.apache.ambari.server.state.State;
 import org.apache.ambari.server.state.host.HostImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -213,7 +209,7 @@ public class HostRequest implements Comparable<HostRequest> {
 
       // Skip INSTALL task in case SysPrepped hosts and in case of server components. In
case of server component
       // START task should run configuration script.
-      if (context.areHostsSysPrepped() && stack != null && !stack.getComponentInfo(component).isClient())
{
+      if (context.shouldSkipInstallTasks() && stack != null && !stack.getComponentInfo(component).isClient())
{
         LOG.info("Skipping create of INSTALL task for {} on {} because host is sysprepped.",
component, hostName);
       } else {
         HostRoleCommand logicalInstallTask = context.createAmbariTask(

http://git-wip-us.apache.org/repos/asf/ambari/blob/5e11d036/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithHostsSyspreppedTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithHostsSyspreppedTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithHostsSyspreppedTest.java
index 99e91ff..d49c21d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithHostsSyspreppedTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithHostsSyspreppedTest.java
@@ -335,7 +335,7 @@ public class ClusterDeployWithHostsSyspreppedTest {
     expect(ambariContext.isClusterKerberosEnabled(CLUSTER_ID)).andReturn(false).anyTimes();
     expect(ambariContext.getClusterId(CLUSTER_NAME)).andReturn(CLUSTER_ID).anyTimes();
     expect(ambariContext.getClusterName(CLUSTER_ID)).andReturn(CLUSTER_NAME).anyTimes();
-    expect(ambariContext.areHostsSysPrepped()).andReturn(true).anyTimes();
+    expect(ambariContext.shouldSkipInstallTasks()).andReturn(true).anyTimes();
     // so only INITIAL config
     expect(ambariContext.createConfigurationRequests(capture(configRequestPropertiesCapture))).
       andReturn(Collections.singletonList(configurationRequest));

http://git-wip-us.apache.org/repos/asf/ambari/blob/5e11d036/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
index 27621a1..ad441e4 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
@@ -333,7 +333,7 @@ public class ClusterInstallWithoutStartTest {
     expect(ambariContext.isClusterKerberosEnabled(CLUSTER_ID)).andReturn(false).anyTimes();
     expect(ambariContext.getClusterId(CLUSTER_NAME)).andReturn(CLUSTER_ID).anyTimes();
     expect(ambariContext.getClusterName(CLUSTER_ID)).andReturn(CLUSTER_NAME).anyTimes();
-    expect(ambariContext.areHostsSysPrepped()).andReturn(false).anyTimes();
+    expect(ambariContext.shouldSkipInstallTasks()).andReturn(false).anyTimes();
     // so only INITIAL config
     expect(ambariContext.createConfigurationRequests(capture(configRequestPropertiesCapture))).
       andReturn(Collections.singletonList(configurationRequest));


Mime
View raw message