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-20818. Blueprint processor fails when StackAdvisor recommends unnecessary configuration types (magyari_sandor)
Date Tue, 25 Apr 2017 12:05:47 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 7df0518f2 -> 9583ede2a


AMBARI-20818. Blueprint processor fails when StackAdvisor recommends unnecessary configuration
types (magyari_sandor)


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

Branch: refs/heads/branch-2.5
Commit: 9583ede2aef55646dc2c11dc03648cee966258ba
Parents: 7df0518
Author: Sandor Magyari <smagyari@hortonworks.com>
Authored: Fri Apr 21 18:50:38 2017 +0200
Committer: Sandor Magyari <smagyari@hortonworks.com>
Committed: Tue Apr 25 14:03:55 2017 +0200

----------------------------------------------------------------------
 .../StackAdvisorBlueprintProcessor.java         | 14 +++-
 .../BlueprintConfigurationProcessor.java        | 88 ++++++++++----------
 .../ambari/server/topology/Blueprint.java       |  8 ++
 .../ambari/server/topology/BlueprintImpl.java   | 15 ++++
 .../topology/ClusterConfigurationRequest.java   | 59 +++++--------
 .../StackAdvisorBlueprintProcessorTest.java     |  4 +
 .../BlueprintConfigurationProcessorTest.java    |  4 +
 .../ClusterConfigurationRequestTest.java        | 18 ++--
 .../ClusterDeployWithStartOnlyTest.java         |  1 +
 ...InstallWithoutStartOnComponentLevelTest.java |  1 +
 .../ClusterInstallWithoutStartTest.java         |  1 +
 11 files changed, 120 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
index cc09ae8..b7b8770 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
@@ -40,6 +40,7 @@ import org.apache.ambari.server.controller.internal.Stack;
 import org.apache.ambari.server.orm.entities.BlueprintConfiguration;
 import org.apache.ambari.server.state.ValueAttributesInfo;
 import org.apache.ambari.server.topology.AdvisedConfiguration;
+import org.apache.ambari.server.topology.Blueprint;
 import org.apache.ambari.server.topology.ClusterTopology;
 import org.apache.ambari.server.topology.ConfigRecommendationStrategy;
 import org.apache.ambari.server.topology.HostGroup;
@@ -176,12 +177,17 @@ public class StackAdvisorBlueprintProcessor {
 
     Map<String, BlueprintConfigurations> recommendedConfigurations =
       response.getRecommendations().getBlueprint().getConfigurations();
+    Blueprint blueprint = topology.getBlueprint();
+
     for (Map.Entry<String, BlueprintConfigurations> configEntry : recommendedConfigurations.entrySet())
{
       String configType = configEntry.getKey();
-      BlueprintConfigurations blueprintConfig = filterBlueprintConfig(configType, configEntry.getValue(),
-              userProvidedConfigurations, topology);
-      topology.getAdvisedConfigurations().put(configType, new AdvisedConfiguration(
-        blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes()));
+      // add recommended config type only if related service is present in Blueprint
+      if (blueprint.isValidConfigType(configType)) {
+        BlueprintConfigurations blueprintConfig = filterBlueprintConfig(configType, configEntry.getValue(),
+                userProvidedConfigurations, topology);
+        topology.getAdvisedConfigurations().put(configType, new AdvisedConfiguration(
+                blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes()));
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index e77d718..061cdf7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -412,7 +412,10 @@ public class BlueprintConfigurationProcessor {
       }
     }
 
-    setMissingConfigurations(clusterConfig, configTypesUpdated);
+    // Explicitly set any properties that are required but not currently provided in the
stack definition.
+    setRetryConfiguration(clusterConfig, configTypesUpdated);
+    setupHDFSProxyUsers(clusterConfig, configTypesUpdated);
+    addExcludedConfigProperties(clusterConfig, configTypesUpdated, clusterTopology.getBlueprint().getStack());
 
     trimProperties(clusterConfig, clusterTopology);
 
@@ -2781,59 +2784,53 @@ public class BlueprintConfigurationProcessor {
     });
   }
 
-  /**
-   * Explicitly set any properties that are required but not currently provided in the stack
definition.
-   *
-   * @param configuration  configuration where properties are to be added
-   */
-  void setMissingConfigurations(Configuration configuration, Set<String> configTypesUpdated)
{
+  private Collection<String> setupHDFSProxyUsers(Configuration configuration, Set<String>
configTypesUpdated) {
     // AMBARI-5206
     final Map<String , String> userProps = new HashMap<String , String>();
 
-    setRetryConfiguration(configuration, configTypesUpdated);
-
     Collection<String> services = clusterTopology.getBlueprint().getServices();
-    // only add user properties to the map for
-    // services actually included in the blueprint definition
-    if (services.contains("OOZIE")) {
-      userProps.put("oozie_user", "oozie-env");
-    }
-
-    if (services.contains("HIVE")) {
-      userProps.put("hive_user", "hive-env");
-      userProps.put("hcat_user", "hive-env");
-    }
+    if (services.contains("HDFS")) {
+      // only add user properties to the map for
+      // services actually included in the blueprint definition
+      if (services.contains("OOZIE")) {
+        userProps.put("oozie_user", "oozie-env");
+      }
 
-    if (services.contains("HBASE")) {
-      userProps.put("hbase_user", "hbase-env");
-    }
+      if (services.contains("HIVE")) {
+        userProps.put("hive_user", "hive-env");
+        userProps.put("hcat_user", "hive-env");
+        userProps.put("webhcat_user", "hive-env");
+      }
 
-    if (services.contains("FALCON")) {
-      userProps.put("falcon_user", "falcon-env");
-    }
+      if (services.contains("HBASE")) {
+        userProps.put("hbase_user", "hbase-env");
+      }
 
-    String proxyUserHosts  = "hadoop.proxyuser.%s.hosts";
-    String proxyUserGroups = "hadoop.proxyuser.%s.groups";
+      if (services.contains("FALCON")) {
+        userProps.put("falcon_user", "falcon-env");
+      }
 
-    Map<String, Map<String, String>> existingProperties = configuration.getFullProperties();
-    for (String property : userProps.keySet()) {
-      String configType = userProps.get(property);
-      Map<String, String> configs = existingProperties.get(configType);
-      if (configs != null) {
-        String user = configs.get(property);
-        if (user != null && !user.isEmpty()) {
-          ensureProperty(configuration, "core-site", String.format(proxyUserHosts, user),
"*", configTypesUpdated);
-          ensureProperty(configuration, "core-site", String.format(proxyUserGroups, user),
"*", configTypesUpdated);
-        }
-      } else {
-        LOG.debug("setMissingConfigurations: no user configuration found for type = " + configType
+
+      String proxyUserHosts = "hadoop.proxyuser.%s.hosts";
+      String proxyUserGroups = "hadoop.proxyuser.%s.groups";
+
+      Map<String, Map<String, String>> existingProperties = configuration.getFullProperties();
+      for (String property : userProps.keySet()) {
+        String configType = userProps.get(property);
+        Map<String, String> configs = existingProperties.get(configType);
+        if (configs != null) {
+          String user = configs.get(property);
+          if (user != null && !user.isEmpty()) {
+            ensureProperty(configuration, "core-site", String.format(proxyUserHosts, user),
"*", configTypesUpdated);
+            ensureProperty(configuration, "core-site", String.format(proxyUserGroups, user),
"*", configTypesUpdated);
+          }
+        } else {
+          LOG.debug("setMissingConfigurations: no user configuration found for type = " +
configType +
                   ".  This may be caused by an error in the blueprint configuration.");
-      }
+        }
 
+      }
     }
-
-    addExcludedConfigProperties(configuration, configTypesUpdated, services, clusterTopology.getBlueprint().getStack());
-
+    return services;
   }
 
   /**
@@ -2843,10 +2840,11 @@ public class BlueprintConfigurationProcessor {
    * In case the excluded config-type related service is not present in the blueprint, excluded
configs are ignored
    * @param configuration
    * @param configTypesUpdated
-   * @param blueprintServices
    * @param stack
    */
-  private void addExcludedConfigProperties(Configuration configuration, Set<String>
configTypesUpdated, Collection<String> blueprintServices, Stack stack) {
+  private void addExcludedConfigProperties(Configuration configuration, Set<String>
configTypesUpdated, Stack stack) {
+    Collection<String> blueprintServices = clusterTopology.getBlueprint().getServices();
+
     LOG.debug("Handling excluded properties for blueprint services: {}", blueprintServices);
 
     for (String blueprintService : blueprintServices) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
index a82f02a..c9dc728 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
@@ -154,6 +154,14 @@ public interface Blueprint {
   public void validateRequiredProperties() throws InvalidTopologyException;
 
   /**
+   *
+   * A config type is valid if there are services related to except cluster-env and global.
+   * @param configType
+   * @return
+   */
+  boolean isValidConfigType(String configType);
+
+  /**
    * Obtain the blueprint as an entity.
    *
    * @return entity representation of the blueprint

http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
index 3ea90b4..1d917e0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
@@ -33,6 +33,7 @@ import org.apache.ambari.server.orm.entities.HostGroupConfigEntity;
 import org.apache.ambari.server.orm.entities.HostGroupEntity;
 import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.stack.NoSuchStackException;
+import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.commons.lang.StringUtils;
 
 import java.util.ArrayList;
@@ -599,4 +600,18 @@ public class BlueprintImpl implements Blueprint {
       blueprintEntity.setSettings(settingEntityMap.values());
     }
   }
+
+  /**
+   * A config type is valid if there are services related to except cluster-env and global.
+   */
+  public boolean isValidConfigType(String configType) {
+    if (ConfigHelper.CLUSTER_ENV.equals(configType) || "global".equals(configType)) {
+      return true;
+    }
+    String service = getStack().getServiceForConfigType(configType);
+    if (getServices().contains(service)) {
+        return true;
+    }
+    return false;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
index 3f657ff..de1d587 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
@@ -66,6 +66,11 @@ public class ClusterConfigurationRequest {
   private Stack stack;
   private boolean configureSecurity = false;
 
+  public ClusterConfigurationRequest(AmbariContext ambariContext, ClusterTopology topology,
boolean setInitial, StackAdvisorBlueprintProcessor stackAdvisorBlueprintProcessor, boolean
configureSecurity) {
+    this(ambariContext, topology, setInitial, stackAdvisorBlueprintProcessor);
+    this.configureSecurity = configureSecurity;
+  }
+
   public ClusterConfigurationRequest(AmbariContext ambariContext, ClusterTopology clusterTopology,
boolean setInitial,
                                      StackAdvisorBlueprintProcessor stackAdvisorBlueprintProcessor)
{
     this.ambariContext = ambariContext;
@@ -82,6 +87,21 @@ public class ClusterConfigurationRequest {
   }
 
   /**
+   * Remove config-types from the given configuration if there is no any services related
to them (except cluster-env and global).
+   */
+  private void removeOrphanConfigTypes(Configuration configuration) {
+    Blueprint blueprint = clusterTopology.getBlueprint();
+
+    Collection<String> configTypes = configuration.getAllConfigTypes();
+    for (String configType : configTypes) {
+      if (!blueprint.isValidConfigType(configType)) {
+        configuration.removeConfigType(configType);
+        LOG.info("Removing config type '{}' as related service is not present in either Blueprint
or cluster creation template.", configType);
+      }
+    }
+  }
+
+  /**
    * Remove config-types, if there is no any services related to them (except cluster-env
and global).
    */
   private void removeOrphanConfigTypes() {
@@ -100,29 +120,6 @@ public class ClusterConfigurationRequest {
     }
   }
 
-  /**
-   * Remove config-types from the given configuration if there is no any services related
to them (except cluster-env and global).
-   */
-  private void removeOrphanConfigTypes(Configuration configuration) {
-    Blueprint blueprint = clusterTopology.getBlueprint();
-
-    Collection<String> configTypes = configuration.getAllConfigTypes();
-    for (String configType : configTypes) {
-      if (!"cluster-env".equals(configType) && !"global".equals(configType)) {
-        String service = blueprint.getStack().getServiceForConfigType(configType);
-        if (!blueprint.getServices().contains(service)) {
-          configuration.removeConfigType(configType);
-          LOG.info("Removing config type '{}' as service '{}' is not present in either Blueprint
or cluster creation template.", configType, service);
-        }
-      }
-    }
-  }
-
-  public ClusterConfigurationRequest(AmbariContext ambariContext, ClusterTopology topology,
boolean setInitial, StackAdvisorBlueprintProcessor stackAdvisorBlueprintProcessor, boolean
configureSecurity) {
-    this(ambariContext, topology, setInitial, stackAdvisorBlueprintProcessor);
-    this.configureSecurity = configureSecurity;
-  }
-
   // get names of required host groups
   public Collection<String> getRequiredHostGroups() {
     Collection<String> requiredHostGroups = new HashSet<String>();
@@ -161,20 +158,6 @@ public class ClusterConfigurationRequest {
     setConfigurationsOnCluster(clusterTopology, TopologyManager.TOPOLOGY_RESOLVED_TAG, updatedConfigTypes);
   }
 
-  /**
-   * A config type is orphaned if there are services related to except cluster-env and global.
-   */
-  private boolean isOrphanedConfigType(String configType, Blueprint blueprint) {
-    boolean isOrphanedConfigType = false;
-    if (!"cluster-env".equals(configType) && !"global".equals(configType)) {
-      String service = blueprint.getStack().getServiceForConfigType(configType);
-      if (!blueprint.getServices().contains(service)) {
-        isOrphanedConfigType = true;
-      }
-    }
-    return isOrphanedConfigType;
-  }
-
   private Set<String> configureKerberos(Configuration clusterConfiguration, Map<String,
Map<String, String>> existingConfigurations) throws AmbariException {
     Set<String> updatedConfigTypes = new HashSet<>();
 
@@ -215,7 +198,7 @@ public class ClusterConfigurationRequest {
 
       for (String configType : updatedConfigs.keySet()) {
         // apply only if config type has related services in Blueprint
-        if (!isOrphanedConfigType(configType, blueprint)) {
+        if (blueprint.isValidConfigType(configType)) {
           Map<String, String> propertyMap = updatedConfigs.get(configType);
           Map<String, String> clusterConfigProperties = existingConfigurations.get(configType);
           Map<String, String> stackDefaultConfigProperties = stackDefaultProps.get(configType);

http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java
index a6bd3a3..633c7fd 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java
@@ -86,6 +86,7 @@ public class StackAdvisorBlueprintProcessorTest {
     expect(stack.getConfiguration(Arrays.asList("HDFS", "YARN", "HIVE"))).andReturn(createStackDefaults()).anyTimes();
     expect(blueprint.getServices()).andReturn(Arrays.asList("HDFS", "YARN", "HIVE")).anyTimes();
     expect(blueprint.getHostGroups()).andReturn(createHostGroupMap()).anyTimes();
+    expect(blueprint.isValidConfigType("core-site")).andReturn(true).anyTimes();
     expect(hostGroup.getComponentNames()).andReturn(Arrays.asList("comp1", "comp2")).anyTimes();
     expect(stackAdvisorHelper.recommend(anyObject(StackAdvisorRequest.class))).andReturn(createRecommendationResponse());
     expect(configuration.getFullProperties()).andReturn(props).anyTimes();
@@ -120,6 +121,7 @@ public class StackAdvisorBlueprintProcessorTest {
     expect(stack.getConfiguration(Arrays.asList("HDFS", "YARN", "HIVE"))).andReturn(createStackDefaults()).anyTimes();
     expect(blueprint.getServices()).andReturn(Arrays.asList("HDFS", "YARN", "HIVE")).anyTimes();
     expect(blueprint.getHostGroups()).andReturn(createHostGroupMap()).anyTimes();
+    expect(blueprint.isValidConfigType("core-site")).andReturn(true).anyTimes();
     expect(hostGroup.getComponentNames()).andReturn(Arrays.asList("comp1", "comp2")).anyTimes();
     expect(stackAdvisorHelper.recommend(anyObject(StackAdvisorRequest.class))).andReturn(createRecommendationResponse());
     expect(configuration.getFullProperties()).andReturn(props).anyTimes();
@@ -155,6 +157,7 @@ public class StackAdvisorBlueprintProcessorTest {
     expect(stack.getConfiguration(Arrays.asList("HDFS", "YARN", "HIVE"))).andReturn(createStackDefaults()).anyTimes();
     expect(blueprint.getServices()).andReturn(Arrays.asList("HDFS", "YARN", "HIVE")).anyTimes();
     expect(blueprint.getHostGroups()).andReturn(createHostGroupMap()).anyTimes();
+    expect(blueprint.isValidConfigType("core-site")).andReturn(true).anyTimes();
     expect(hostGroup.getComponentNames()).andReturn(Arrays.asList("comp1", "comp2")).anyTimes();
     expect(stackAdvisorHelper.recommend(anyObject(StackAdvisorRequest.class))).andReturn(createRecommendationResponse());
     expect(configuration.getFullProperties()).andReturn(props).anyTimes();
@@ -188,6 +191,7 @@ public class StackAdvisorBlueprintProcessorTest {
     expect(stack.getConfiguration(Arrays.asList("HDFS", "YARN", "HIVE"))).andReturn(createStackDefaults()).anyTimes();
     expect(blueprint.getServices()).andReturn(Arrays.asList("HDFS", "YARN", "HIVE")).anyTimes();
     expect(blueprint.getHostGroups()).andReturn(createHostGroupMap()).anyTimes();
+    expect(blueprint.isValidConfigType("core-site")).andReturn(true).anyTimes();
     expect(hostGroup.getComponentNames()).andReturn(Arrays.asList("comp1", "comp2")).anyTimes();
     expect(stackAdvisorHelper.recommend(anyObject(StackAdvisorRequest.class))).andReturn(createRecommendationResponse());
     expect(configuration.getFullProperties()).andReturn(props).anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index b763bd7..793caf1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
@@ -5772,6 +5772,7 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport
{
       Collections.<String, Map<String, Map<String, String>>>emptyMap());
 
     Collection<String> hgComponents1 = new HashSet<>();
+    hgComponents1.add("DATANODE");
     hgComponents1.add("OOZIE_SERVER");
     hgComponents1.add("HIVE_SERVER");
     hgComponents1.add("HBASE_MASTER");
@@ -5818,6 +5819,7 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport
{
       Collections.<String, Map<String, Map<String, String>>>emptyMap());
 
     Collection<String> hgComponents1 = new HashSet<>();
+    hgComponents1.add("DATANODE");
     hgComponents1.add("OOZIE_SERVER");
     hgComponents1.add("FALCON_SERVER");
     TestHostGroup group1 = new TestHostGroup("group1", hgComponents1, Collections.singleton("host1"));
@@ -5861,6 +5863,7 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport
{
       Collections.<String, Map<String, Map<String, String>>>emptyMap());
 
     Collection<String> hgComponents1 = new HashSet<>();
+    hgComponents1.add("DATANODE");
     hgComponents1.add("OOZIE_SERVER");
     hgComponents1.add("FALCON_SERVER");
     TestHostGroup group1 = new TestHostGroup("group1", hgComponents1, Collections.singleton("host1"));
@@ -5903,6 +5906,7 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport
{
       Collections.<String, Map<String, Map<String, String>>>emptyMap(),
parentClusterConfig);
 
     Collection<String> hgComponents1 = new HashSet<>();
+    hgComponents1.add("DATANODE");
     hgComponents1.add("OOZIE_SERVER");
     hgComponents1.add("FALCON_SERVER");
     TestHostGroup group1 = new TestHostGroup("group1", hgComponents1, Collections.singleton("host1"));

http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
index a97378f..53bd405 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
@@ -248,6 +248,8 @@ public class ClusterConfigurationRequestTest {
 
     expect(topology.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.NEVER_APPLY).anyTimes();
     expect(topology.getBlueprint()).andReturn(blueprint).anyTimes();
+    expect(blueprint.isValidConfigType("testConfigType")).andReturn(true).anyTimes();
+
     expect(topology.getConfiguration()).andReturn(blueprintConfig).anyTimes();
     expect(topology.getHostGroupInfo()).andReturn(Collections.<String, HostGroupInfo>emptyMap()).anyTimes();
     expect(topology.getClusterId()).andReturn(Long.valueOf(1)).anyTimes();
@@ -368,9 +370,12 @@ public class ClusterConfigurationRequestTest {
     expect(topology.getHostGroupInfo()).andReturn(hostGroupInfoMap);
     expect(blueprint.getStack()).andReturn(stack).anyTimes();
     expect(blueprint.getServices()).andReturn(services).anyTimes();
-    expect(stack.getServiceForConfigType("hdfs-site")).andReturn("HDFS").anyTimes();
-    expect(stack.getServiceForConfigType("admin-properties")).andReturn("RANGER").anyTimes();
-    expect(stack.getServiceForConfigType("yarn-site")).andReturn("YARN").anyTimes();
+
+    expect(blueprint.isValidConfigType("hdfs-site")).andReturn(true).anyTimes();
+    expect(blueprint.isValidConfigType("admin-properties")).andReturn(true).anyTimes();
+    expect(blueprint.isValidConfigType("yarn-site")).andReturn(false).anyTimes();
+    expect(blueprint.isValidConfigType("cluster-env")).andReturn(true).anyTimes();
+    expect(blueprint.isValidConfigType("global")).andReturn(true).anyTimes();
 
     EasyMock.replay(stack, blueprint, topology);
     // WHEN
@@ -409,9 +414,10 @@ public class ClusterConfigurationRequestTest {
     expect(topology.getHostGroupInfo()).andReturn(hostGroupInfoMap);
     expect(blueprint.getStack()).andReturn(stack).anyTimes();
     expect(blueprint.getServices()).andReturn(services).anyTimes();
-    expect(stack.getServiceForConfigType("hdfs-site")).andReturn("HDFS").anyTimes();
-    expect(stack.getServiceForConfigType("admin-properties")).andReturn("RANGER").anyTimes();
-    expect(stack.getServiceForConfigType("yarn-site")).andReturn("YARN").anyTimes();
+
+    expect(blueprint.isValidConfigType("hdfs-site")).andReturn(true).anyTimes();
+    expect(blueprint.isValidConfigType("cluster-env")).andReturn(true).anyTimes();
+    expect(blueprint.isValidConfigType("global")).andReturn(true).anyTimes();
 
     EasyMock.replay(stack, blueprint, topology);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java
index 6bcd6bc..c8d4d55 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java
@@ -251,6 +251,7 @@ public class ClusterDeployWithStartOnlyTest extends EasyMockSupport {
     expect(blueprint.getName()).andReturn(BLUEPRINT_NAME).anyTimes();
     expect(blueprint.getServices()).andReturn(Arrays.asList("service1", "service2")).anyTimes();
     expect(blueprint.getStack()).andReturn(stack).anyTimes();
+    expect(blueprint.isValidConfigType(anyString())).andReturn(true).anyTimes();
     // don't expect toEntity()
 
     expect(stack.getAllConfigurationTypes("service1")).andReturn(Arrays.asList("service1-site",
"service1-env")).anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java
index 0631b03..4c9815c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java
@@ -247,6 +247,7 @@ public class ClusterInstallWithoutStartOnComponentLevelTest extends EasyMockSupp
     expect(blueprint.getName()).andReturn(BLUEPRINT_NAME).anyTimes();
     expect(blueprint.getServices()).andReturn(Arrays.asList("service1", "service2")).anyTimes();
     expect(blueprint.getStack()).andReturn(stack).anyTimes();
+    expect(blueprint.isValidConfigType(anyString())).andReturn(true).anyTimes();
     // don't expect toEntity()
 
     expect(stack.getAllConfigurationTypes("service1")).andReturn(Arrays.asList("service1-site",
"service1-env")).anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/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 c074d78..1bdeb1b 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
@@ -248,6 +248,7 @@ public class ClusterInstallWithoutStartTest extends EasyMockSupport {
     expect(blueprint.getName()).andReturn(BLUEPRINT_NAME).anyTimes();
     expect(blueprint.getServices()).andReturn(Arrays.asList("service1", "service2")).anyTimes();
     expect(blueprint.getStack()).andReturn(stack).anyTimes();
+    expect(blueprint.isValidConfigType(anyString())).andReturn(true).anyTimes();
     // don't expect toEntity()
 
     expect(stack.getAllConfigurationTypes("service1")).andReturn(Arrays.asList("service1-site",
"service1-env")).anyTimes();


Mime
View raw message