This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new 676618b  AMBARI-25210. ONEFS installation via blueprint fails 
(amagyar) (#2886)
676618b is described below

commit 676618b93ba40ef248dac7af2010accb381ce45d
Author: Attila Magyar <m.magy...@gmail.com>
AuthorDate: Mon Apr 1 11:27:28 2019 +0200

    AMBARI-25210. ONEFS installation via blueprint fails (amagyar) (#2886)
---
 .../controller/internal/BlueprintConfigurationProcessor.java       | 2 +-
 .../java/org/apache/ambari/server/topology/ClusterTopology.java    | 4 ++--
 .../org/apache/ambari/server/topology/ClusterTopologyImpl.java     | 7 ++-----
 .../org/apache/ambari/server/topology/ClusterTopologyImplTest.java | 4 +---
 4 files changed, 6 insertions(+), 11 deletions(-)

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 31a157f..68e7392 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
@@ -1950,7 +1950,7 @@ public class BlueprintConfigurationProcessor {
               return origValue;
             }
 
-            if (topology.isComponentHadoopCompatible(component)) {
+            if (isComponentNameNode() && 
topology.hasHadoopCompatibleService()) { // do not fail, could be a ONEFS 
installation
               return origValue;
             }
 
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java
index e1cab2b..844c355 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java
@@ -181,7 +181,7 @@ public interface ClusterTopology {
   String getDefaultPassword();
 
   /**
-   * @return true if the given component belongs to a service that has 
serviceType=HCFS
+   * @return true if the topology contains any service with HCFS tag
    */
-  boolean isComponentHadoopCompatible(String component);
+  boolean hasHadoopCompatibleService();
 }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
index 4860a94..a1bdf65 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
@@ -315,12 +315,9 @@ public class ClusterTopologyImpl implements 
ClusterTopology {
   }
 
   @Override
-  public boolean isComponentHadoopCompatible(String component) {
+  public boolean hasHadoopCompatibleService() {
     return blueprint.getServiceInfos().stream()
-      .filter(service -> service.getComponentByName(component) != null)
-      .findFirst()
-      .map(service -> HADOOP_COMPATIBLE_FS.equals(service.getServiceType()))
-      .orElse(false);
+      .anyMatch(service -> 
HADOOP_COMPATIBLE_FS.equals(service.getServiceType()));
   }
 
   private void registerHostGroupInfo(Map<String, HostGroupInfo> 
requestedHostGroupInfoMap) throws InvalidTopologyException {
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
index 7ce5098..b3c9de9 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
@@ -21,7 +21,6 @@ package org.apache.ambari.server.topology;
 import static java.util.Arrays.asList;
 import static java.util.Collections.singletonList;
 import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.powermock.api.easymock.PowerMock.createNiceMock;
 import static org.powermock.api.easymock.PowerMock.replay;
@@ -232,8 +231,7 @@ public class ClusterTopologyImplTest {
     ).anyTimes();
     replayAll();
     ClusterTopologyImpl topology = new ClusterTopologyImpl(null, new 
TestTopologyRequest(TopologyRequest.Type.PROVISION));
-    assertTrue(topology.isComponentHadoopCompatible("ONEFS_CLIENT"));
-    assertFalse(topology.isComponentHadoopCompatible("ZOOKEEPER_CLIENT"));
+    assertTrue(topology.hasHadoopCompatibleService());
   }
 
   private ServiceInfo aHCFSWith(ComponentInfo... components) {

Reply via email to