You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2015/08/12 14:21:17 UTC

ambari git commit: AMBARI-12736. Hbase user not being added to hbase.superuser in Hbase config.(vbrodetskyi)

Repository: ambari
Updated Branches:
  refs/heads/trunk e482d7c4e -> 0613c0a8a


AMBARI-12736. Hbase user not being added to hbase.superuser in Hbase config.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: 0613c0a8a307d62767b1c4edf13e943e45841cf9
Parents: e482d7c
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Wed Aug 12 15:19:51 2015 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Wed Aug 12 15:19:51 2015 +0300

----------------------------------------------------------------------
 .../0.96.0.2.0/configuration/hbase-site.xml     |  6 +++++
 .../stacks/HDP/2.0.6/services/stack_advisor.py  | 17 ++++++++++---
 .../stacks/HDP/2.2/services/stack_advisor.py    |  2 +-
 .../stacks/2.0.6/common/test_stack_advisor.py   | 25 ++++++++++++++++++--
 .../stacks/2.1/common/test_stack_advisor.py     | 25 ++++++++++++++++++--
 .../stacks/2.2/common/test_stack_advisor.py     | 25 ++++++++++++++++++--
 6 files changed, 90 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0613c0a8/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
index 65f72a7..b224bef 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
@@ -327,6 +327,12 @@
     full privileges, regardless of stored ACLs, across the cluster.
     Only used when HBase security is enabled.
     </description>
+    <depends-on>
+      <property>
+        <type>hbase-env</type>
+        <name>hbase_user</name>
+      </property>
+    </depends-on>
   </property>
 
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/0613c0a8/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 5c65535..8af6d91 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -84,7 +84,7 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
       "YARN": self.recommendYARNConfigurations,
       "MAPREDUCE2": self.recommendMapReduce2Configurations,
       "HDFS": self.recommendHDFSConfigurations,
-      "HBASE": self.recommendHbaseEnvConfigurations,
+      "HBASE": self.recommendHbaseConfigurations,
       "AMBARI_METRICS": self.recommendAmsConfigurations
     }
 
@@ -149,11 +149,20 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
     putHDFSProperty = self.putProperty(configurations, "hadoop-env", services)
     putHDFSProperty('namenode_opt_maxnewsize', max(int(clusterData['totalAvailableRam'] / 8), 256))
 
-  def recommendHbaseEnvConfigurations(self, configurations, clusterData, services, hosts):
+  def recommendHbaseConfigurations(self, configurations, clusterData, services, hosts):
+    # recommendations for HBase env config
     putHbaseProperty = self.putProperty(configurations, "hbase-env", services)
     putHbaseProperty('hbase_regionserver_heapsize', int(clusterData['hbaseRam']) * 1024)
     putHbaseProperty('hbase_master_heapsize', int(clusterData['hbaseRam']) * 1024)
 
+    # recommendations for HBase site config
+    putHbaseSiteProperty = self.putProperty(configurations, "hbase-site", services)
+
+    if 'hbase-site' in services['configurations'] and 'hbase.superuser' in services['configurations']['hbase-site']['properties'] \
+      and 'hbase-env' in services['configurations'] and 'hbase_user' in services['configurations']['hbase-env']['properties'] \
+      and services['configurations']['hbase-env']['properties']['hbase_user'] != services['configurations']['hbase-site']['properties']['hbase.superuser']:
+      putHbaseSiteProperty("hbase.superuser", services['configurations']['hbase-env']['properties']['hbase_user'])
+
   def recommendAmsConfigurations(self, configurations, clusterData, services, hosts):
     putAmsEnvProperty = self.putProperty(configurations, "ams-env", services)
     putAmsHbaseSiteProperty = self.putProperty(configurations, "ams-hbase-site", services)
@@ -706,8 +715,10 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
     return self.toConfigurationValidationProblems(validationItems, "yarn-site")
 
   def validateHbaseEnvConfigurations(self, properties, recommendedDefaults, configurations, services, hosts):
+    hbase_site = getSiteProperties(configurations, "hbase-site")
     validationItems = [ {"config-name": 'hbase_regionserver_heapsize', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'hbase_regionserver_heapsize')},
-                        {"config-name": 'hbase_master_heapsize', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'hbase_master_heapsize')} ]
+                        {"config-name": 'hbase_master_heapsize', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'hbase_master_heapsize')},
+                        {"config-name": "hbase_user", "item": self.validatorEqualsPropertyItem(properties, "hbase_user", hbase_site, "hbase.superuser")} ]
     return self.toConfigurationValidationProblems(validationItems, "hbase-env")
 
   def validateHDFSConfigurationsEnv(self, properties, recommendedDefaults, configurations, services, hosts):

http://git-wip-us.apache.org/repos/asf/ambari/blob/0613c0a8/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
index 6bb6a9d..16f7e74 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
@@ -477,7 +477,7 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
 
 
   def recommendHBASEConfigurations(self, configurations, clusterData, services, hosts):
-    super(HDP22StackAdvisor, self).recommendHbaseEnvConfigurations(configurations, clusterData, services, hosts)
+    super(HDP22StackAdvisor, self).recommendHbaseConfigurations(configurations, clusterData, services, hosts)
     putHbaseEnvPropertyAttributes = self.putPropertyAttribute(configurations, "hbase-env")
 
     hmaster_host = self.getHostWithComponent("HBASE", "HBASE_MASTER", services, hosts)

http://git-wip-us.apache.org/repos/asf/ambari/blob/0613c0a8/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index 33895be..b478cc0 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -615,7 +615,7 @@ class TestHDP206StackAdvisor(TestCase):
       actualItems.append(next)
     self.checkEqual(expectedItems, actualItems)
 
-  def test_recommendHbaseEnvConfigurations(self):
+  def test_recommendHbaseConfigurations(self):
     servicesList = ["HBASE"]
     configurations = {}
     components = []
@@ -637,7 +637,28 @@ class TestHDP206StackAdvisor(TestCase):
         }
       ]
     }
+    services = {
+      "services" : [
+      ],
+      "configurations": {
+        "hbase-site": {
+          "properties": {
+            "hbase.superuser": "hbase"
+          }
+        },
+        "hbase-env": {
+          "properties": {
+            "hbase_user": "hbase123"
+          }
+        }
+      }
+    }
     expected = {
+      'hbase-site': {
+        'properties': {
+          'hbase.superuser': 'hbase123'
+        }
+      },
       "hbase-env": {
         "properties": {
           "hbase_master_heapsize": "8192",
@@ -649,7 +670,7 @@ class TestHDP206StackAdvisor(TestCase):
     clusterData = self.stackAdvisor.getConfigurationClusterSummary(servicesList, hosts, components, None)
     self.assertEquals(clusterData['hbaseRam'], 8)
 
-    self.stackAdvisor.recommendHbaseEnvConfigurations(configurations, clusterData, None, None)
+    self.stackAdvisor.recommendHbaseConfigurations(configurations, clusterData, services, None)
     self.assertEquals(configurations, expected)
 
   def test_recommendHDFSConfigurations(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/0613c0a8/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
index 3728d8e..0d5caf6 100644
--- a/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
@@ -161,7 +161,7 @@ class TestHDP21StackAdvisor(TestCase):
     self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, None, None)
     self.assertEquals(configurations, expected)
 
-  def test_recommendHbaseEnvConfigurations(self):
+  def test_recommendHbaseConfigurations(self):
     servicesList = ["HBASE"]
     configurations = {}
     components = []
@@ -183,7 +183,28 @@ class TestHDP21StackAdvisor(TestCase):
         }
       ]
     }
+    services = {
+      "services" : [
+      ],
+      "configurations": {
+        "hbase-site": {
+          "properties": {
+            "hbase.superuser": "hbase"
+          }
+        },
+        "hbase-env": {
+          "properties": {
+            "hbase_user": "hbase123"
+          }
+        }
+      }
+    }
     expected = {
+      'hbase-site': {
+        'properties': {
+          'hbase.superuser': 'hbase123'
+        }
+      },
       "hbase-env": {
         "properties": {
           "hbase_master_heapsize": "8192",
@@ -195,7 +216,7 @@ class TestHDP21StackAdvisor(TestCase):
     clusterData = self.stackAdvisor.getConfigurationClusterSummary(servicesList, hosts, components, None)
     self.assertEquals(clusterData['hbaseRam'], 8)
 
-    self.stackAdvisor.recommendHbaseEnvConfigurations(configurations, clusterData, None, None)
+    self.stackAdvisor.recommendHbaseConfigurations(configurations, clusterData, services, None)
     self.assertEquals(configurations, expected)
 
   def test_recommendHDFSConfigurations(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/0613c0a8/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
index 4662126..e764739 100644
--- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
@@ -1884,7 +1884,7 @@ class TestHDP22StackAdvisor(TestCase):
     self.stackAdvisor.recommendAmsConfigurations(configurations, clusterData, services, hosts)
     self.assertEquals(configurations, expected)
     
-  def test_recommendHbaseEnvConfigurations(self):
+  def test_recommendHbaseConfigurations(self):
     servicesList = ["HBASE"]
     configurations = {}
     components = []
@@ -1906,7 +1906,28 @@ class TestHDP22StackAdvisor(TestCase):
         }
       ]
     }
+    services = {
+      "services" : [
+      ],
+      "configurations": {
+        "hbase-site": {
+          "properties": {
+            "hbase.superuser": "hbase"
+          }
+        },
+        "hbase-env": {
+          "properties": {
+            "hbase_user": "hbase123"
+          }
+        }
+      }
+    }
     expected = {
+      'hbase-site': {
+        'properties': {
+          'hbase.superuser': 'hbase123'
+        }
+      },
       "hbase-env": {
         "properties": {
           "hbase_master_heapsize": "8192",
@@ -1918,7 +1939,7 @@ class TestHDP22StackAdvisor(TestCase):
     clusterData = self.stackAdvisor.getConfigurationClusterSummary(servicesList, hosts, components, None)
     self.assertEquals(clusterData['hbaseRam'], 8)
 
-    self.stackAdvisor.recommendHbaseEnvConfigurations(configurations, clusterData, None, None)
+    self.stackAdvisor.recommendHbaseConfigurations(configurations, clusterData, services, None)
     self.assertEquals(configurations, expected)
 
   def test_recommendHbaseSiteConfigurations(self):