You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2016/03/31 22:07:48 UTC
ambari git commit: AMBARI-15653. Blueprint installation with Hive
without Atlas fails (aonishuk)
Repository: ambari
Updated Branches:
refs/heads/trunk 449be0f5c -> 2b122b3b7
AMBARI-15653. Blueprint installation with Hive without Atlas fails (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2b122b3b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2b122b3b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2b122b3b
Branch: refs/heads/trunk
Commit: 2b122b3b70c115d60f9c042e625c0b6e4422fbc3
Parents: 449be0f
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Mar 31 23:07:39 2016 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Mar 31 23:07:39 2016 +0300
----------------------------------------------------------------------
.../BlueprintConfigurationProcessor.java | 32 ++++++++++++--------
.../BlueprintConfigurationProcessorTest.java | 32 ++++++++++++++++++++
2 files changed, 52 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b122b3b/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 9cc7b13..1ba138b 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
@@ -2412,19 +2412,27 @@ public class BlueprintConfigurationProcessor {
//todo: john - this property should be removed
hiveSiteMap.put("atlas.rest.address", new SingleHostTopologyUpdater("ATLAS_SERVER") {
@Override
- public String replacePropertyValue(String origValue, String host, Map<String, Map<String, String>> properties) {
- boolean tlsEnabled = Boolean.parseBoolean(properties.get("application-properties").get("atlas.enableTLS"));
- String scheme;
- String port;
- if (tlsEnabled) {
- scheme = "https";
- port = properties.get("application-properties").get("atlas.server.https.port");
- } else {
- scheme = "http";
- port = properties.get("application-properties").get("atlas.server.http.port");
+ public String updateForClusterCreate(String propertyName,
+ String origValue,
+ Map<String, Map<String, String>> properties,
+ ClusterTopology topology) {
+ if (topology.getBlueprint().getServices().contains("ATLAS")) {
+ String host = topology.getHostAssignmentsForComponent("ATLAS_SERVER").iterator().next();
+
+ boolean tlsEnabled = Boolean.parseBoolean(properties.get("application-properties").get("atlas.enableTLS"));
+ String scheme;
+ String port;
+ if (tlsEnabled) {
+ scheme = "https";
+ port = properties.get("application-properties").get("atlas.server.https.port");
+ } else {
+ scheme = "http";
+ port = properties.get("application-properties").get("atlas.server.http.port");
+ }
+
+ return String.format("%s://%s:%s", scheme, host, port);
}
-
- return String.format("%s://%s:%s", scheme, host, port);
+ return origValue;
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b122b3b/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 14a718d..411f966 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
@@ -5396,6 +5396,38 @@ public class BlueprintConfigurationProcessorTest {
}
@Test
+ public void testHiveWithoutAtlas() throws Exception {
+ Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>();
+
+ Map<String, String> hiveProperties = new HashMap<String, String>();
+ hiveProperties.put("hive.exec.post.hooks", "");
+ hiveProperties.put("atlas.cluster.name", "primary");
+ hiveProperties.put("atlas.rest.address", "http://localhost:21000");
+ properties.put("hive-site", hiveProperties);
+
+
+ Map<String, Map<String, String>> parentProperties = new HashMap<String, Map<String, String>>();
+ Configuration parentClusterConfig = new Configuration(parentProperties,
+ Collections.<String, Map<String, Map<String, String>>>emptyMap());
+ Configuration clusterConfig = new Configuration(properties,
+ Collections.<String, Map<String, Map<String, String>>>emptyMap(), parentClusterConfig);
+
+
+ Collection<String> hgComponents1 = new HashSet<String>();
+ hgComponents1.add("HIVE_SERVER");
+ TestHostGroup group1 = new TestHostGroup("group1", hgComponents1, Collections.singleton("host1"));
+
+ Collection<TestHostGroup> hostGroups = Collections.singletonList(group1);
+
+ ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups);
+ BlueprintConfigurationProcessor configProcessor = new BlueprintConfigurationProcessor(topology);
+
+ configProcessor.doUpdateForClusterCreate();
+
+ assertEquals("http://localhost:21000", clusterConfig.getPropertyValue("hive-site", "atlas.rest.address"));
+ }
+
+ @Test
public void testAtlasHiveProperties() throws Exception {
Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>();
Map<String, String> atlasProperties = new HashMap<String, String>();