ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject ambari git commit: AMBARI-20305. All HBase Masters listed as in standby if Hbase ssl is enabled (dsen via smohanty)
Date Sat, 04 Mar 2017 03:12:25 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 543dd463a -> 2450dde8a


AMBARI-20305. All HBase Masters listed as in standby if Hbase ssl is enabled (dsen via smohanty)


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

Branch: refs/heads/trunk
Commit: 2450dde8a28f2b02e928640b2171e129852258f5
Parents: 543dd46
Author: Sumit Mohanty <smohanty@hortonworks.com>
Authored: Fri Mar 3 19:11:05 2017 -0800
Committer: Sumit Mohanty <smohanty@hortonworks.com>
Committed: Fri Mar 3 19:11:05 2017 -0800

----------------------------------------------------------------------
 .../internal/AbstractProviderModule.java        | 21 +++++++------
 .../internal/JMXHostProviderTest.java           | 33 ++++++++++++++++++++
 2 files changed, 45 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2450dde8/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
index 6967fee..55a772a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
@@ -175,11 +175,11 @@ public abstract class AbstractProviderModule implements ProviderModule,
     jmxDesiredProperties.put("RESOURCEMANAGER", initPropMap);
 
     initPropMap = new HashMap<String, String[]>();
-    initPropMap.put("HBASE_MASTER", new String[]{"hbase.http.policy"});
+    initPropMap.put("HBASE_MASTER", new String[]{"hbase.ssl.enabled"});
     jmxDesiredProperties.put("HBASE_MASTER", initPropMap);
 
     initPropMap = new HashMap<String, String[]>();
-    initPropMap.put("HBASE_REGIONSERVER", new String[]{"hbase.http.policy"});
+    initPropMap.put("HBASE_REGIONSERVER", new String[]{"hbase.ssl.enabled"});
     jmxDesiredProperties.put("HBASE_REGIONSERVER", initPropMap);
 
     initPropMap = new HashMap<String, String[]>();
@@ -1131,7 +1131,14 @@ public abstract class AbstractProviderModule implements ProviderModule,
               clusterName,
               newSiteConfigVersion, config,
               jmxDesiredProperties.get(componentName));
-          jmxProtocolString = getJMXProtocolString(protocolMap.get(componentName));
+          boolean isHttpsEnabled;
+          String propetyVal = protocolMap.get(componentName);
+          if (service.equals(Service.Type.HBASE)) {
+            isHttpsEnabled = Boolean.valueOf(propetyVal);
+          } else {
+            isHttpsEnabled = PROPERTY_HDFS_HTTP_POLICY_VALUE_HTTPS_ONLY.equals(propetyVal);
+          }
+          jmxProtocolString = getJMXProtocolStringFromBool(isHttpsEnabled);
         }
       } else {
         jmxProtocolString = "http";
@@ -1159,12 +1166,8 @@ public abstract class AbstractProviderModule implements ProviderModule,
     return jmxProtocolString;
   }
 
-  private String getJMXProtocolString(String value) {
-    if (PROPERTY_HDFS_HTTP_POLICY_VALUE_HTTPS_ONLY.equals(value)) {
-      return "https";
-    } else {
-      return "http";
-    }
+  private String getJMXProtocolStringFromBool(boolean isHttpsEnabled) {
+    return isHttpsEnabled ? "https" : "http";
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/2450dde8/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
index 270d50a..4a57092 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
@@ -228,10 +228,12 @@ public class JMXHostProviderTest {
     String serviceName = "HDFS";
     String serviceName2 = "YARN";
     String serviceName3 = "MAPREDUCE2";
+    String serviceName4 = "HBASE";
 
     createService(clusterName, serviceName, null);
     createService(clusterName, serviceName2, null);
     createService(clusterName, serviceName3, null);
+    createService(clusterName, serviceName4, null);
 
     String componentName1 = "NAMENODE";
     String componentName2 = "DATANODE";
@@ -240,6 +242,8 @@ public class JMXHostProviderTest {
     String componentName5 = "JOURNALNODE";
     String componentName6 = "HISTORYSERVER";
     String componentName7 = "NODEMANAGER";
+    String componentName8 = "HBASE_MASTER";
+    String componentName9 = "HBASE_REGIONSERVER";
 
     createServiceComponent(clusterName, serviceName, componentName1,
       State.INIT);
@@ -255,6 +259,10 @@ public class JMXHostProviderTest {
         State.INIT);
     createServiceComponent(clusterName, serviceName2, componentName7,
       State.INIT);
+    createServiceComponent(clusterName, serviceName4, componentName8,
+      State.INIT);
+    createServiceComponent(clusterName, serviceName4, componentName9,
+      State.INIT);
 
     String host1 = "h1";
     clusters.addHost(host1);
@@ -291,6 +299,10 @@ public class JMXHostProviderTest {
       host2, null);
     createServiceComponentHost(clusterName, serviceName2, componentName7,
       host2, null);
+    createServiceComponentHost(clusterName, serviceName4, componentName8,
+      host1, null);
+    createServiceComponentHost(clusterName, serviceName4, componentName9,
+      host2, null);
 
     // Create configs
     Map<String, String> configs = new HashMap<String, String>();
@@ -312,6 +324,9 @@ public class JMXHostProviderTest {
     mapreduceConfigs.put(MAPREDUCE_HTTPS_PORT, "19889");
     mapreduceConfigs.put(MAPREDUCE_HTTPS_POLICY, "HTTPS_ONLY");
 
+    Map<String, String> hbaseConfigs = new HashMap<String, String>();
+    hbaseConfigs.put("hbase.ssl.enabled", "true");
+
     ConfigurationRequest cr1 = new ConfigurationRequest(clusterName,
       "hdfs-site", "versionN", configs, null);
 
@@ -332,6 +347,11 @@ public class JMXHostProviderTest {
       crReq.setDesiredConfig(Collections.singletonList(cr3));
       controller.updateClusters(Collections.singleton(crReq), null);
 
+    ConfigurationRequest cr4 = new ConfigurationRequest(clusterName,
+        "hbase-site", "versionN", hbaseConfigs, null);
+      crReq.setDesiredConfig(Collections.singletonList(cr4));
+      controller.updateClusters(Collections.singleton(crReq), null);
+
     Assert.assertEquals("versionN", cluster.getDesiredConfigByType("yarn-site")
       .getTag());
     Assert.assertEquals("localhost:${ambari.dfs.datanode.http.port}", cluster.getDesiredConfigByType
@@ -566,6 +586,19 @@ public class JMXHostProviderTest {
   }
 
   @Test
+  public void testJMXHbaseMasterHttps() throws
+          NoSuchParentResourceException,
+          ResourceAlreadyExistsException, UnsupportedPropertyException,
+          SystemException, AmbariException, NoSuchResourceException {
+    createConfigs();
+    JMXHostProviderModule providerModule = new JMXHostProviderModule(controller);
+    providerModule.registerResourceProvider(Resource.Type.Cluster);
+    providerModule.registerResourceProvider(Resource.Type.Configuration);
+    Assert.assertEquals("https", providerModule.getJMXProtocol("c1", "HBASE_MASTER"));
+    Assert.assertEquals("https", providerModule.getJMXProtocol("c1", "HBASE_REGIONSERVER"));
+  }
+
+  @Test
   public void testJMXPortMapUpdate() throws
     NoSuchParentResourceException,
     ResourceAlreadyExistsException, UnsupportedPropertyException,


Mime
View raw message