ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject ambari git commit: AMBARI-11573. Add SecureBulkLoadEndpoint to hbase.coprocessor.region.classes even for un secure hbase cluster - Enabling testcase again
Date Mon, 01 Jun 2015 22:26:59 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 7f5d9487e -> 43747102b


AMBARI-11573. Add SecureBulkLoadEndpoint to hbase.coprocessor.region.classes even for un secure
hbase cluster - Enabling testcase again


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

Branch: refs/heads/trunk
Commit: 43747102b5ebd862e6ae3e9348ab7420802e8592
Parents: 7f5d948
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Mon Jun 1 15:23:34 2015 -0700
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Mon Jun 1 15:23:40 2015 -0700

----------------------------------------------------------------------
 .../stacks/HDP/2.2/services/stack_advisor.py    | 33 +++++++++++---------
 .../stacks/2.2/common/test_stack_advisor.py     |  9 +++---
 2 files changed, 23 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/43747102/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 0b967fb..2338b1d 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
@@ -522,6 +522,15 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
       putHbaseEnvProperty('hbase_max_direct_memory_size', '')
 
     # Authorization
+    hbase_coprocessor_region_classes = None
+    if 'hbase.coprocessor.region.classes' in configurations["hbase-site"]["properties"]:
+      hbase_coprocessor_region_classes = configurations["hbase-site"]["properties"]["hbase.coprocessor.region.classes"].strip()
+    elif 'hbase.coprocessor.region.classes' in services['configurations']["hbase-site"]["properties"]:
+      hbase_coprocessor_region_classes = services['configurations']["hbase-site"]["properties"]["hbase.coprocessor.region.classes"].strip()
+    if hbase_coprocessor_region_classes:
+      coprocessorRegionClassList = hbase_coprocessor_region_classes.split(',')
+    else:
+      coprocessorRegionClassList = []
     # If configurations has it - it has priority as it is calculated. Then, the service's
configurations will be used.
     hbase_security_authorization = None
     if 'hbase-site' in configurations and 'hbase.security.authorization' in configurations['hbase-site']['properties']:
@@ -531,38 +540,32 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
     if hbase_security_authorization:
       if 'true' == hbase_security_authorization.lower():
         putHbaseProperty('hbase.coprocessor.master.classes', "org.apache.hadoop.hbase.security.access.AccessController")
-        putHbaseProperty('hbase.coprocessor.region.classes', "org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint,org.apache.hadoop.hbase.security.access.AccessController")
+        coprocessorRegionClassList.append("org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint")
+        coprocessorRegionClassList.append("org.apache.hadoop.hbase.security.access.AccessController")
         putHbaseProperty('hbase.coprocessor.regionserver.classes', "org.apache.hadoop.hbase.security.access.AccessController")
       else:
         putHbaseProperty('hbase.coprocessor.master.classes', "")
-        putHbaseProperty('hbase.coprocessor.region.classes', "org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint")
+        coprocessorRegionClassList.append("org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint")
         putHbaseSitePropertyAttributes('hbase.coprocessor.regionserver.classes', 'delete',
'true')
     else:
-      putHbaseProperty('hbase.coprocessor.region.classes', "org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint")
+      coprocessorRegionClassList.append("org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint")
       putHbaseSitePropertyAttributes('hbase.coprocessor.regionserver.classes', 'delete',
'true')
 
     # Authentication
     if 'hbase-site' in services['configurations'] and 'hbase.security.authentication' in
services['configurations']['hbase-site']['properties']:
-      hbase_coprocessor_region_classes = None
-      if 'hbase.coprocessor.region.classes' in configurations["hbase-site"]["properties"]:
-        hbase_coprocessor_region_classes = configurations["hbase-site"]["properties"]["hbase.coprocessor.region.classes"].strip()
-      elif 'hbase.coprocessor.region.classes' in services['configurations']["hbase-site"]["properties"]:
-        hbase_coprocessor_region_classes = services['configurations']["hbase-site"]["properties"]["hbase.coprocessor.region.classes"].strip()
-      if hbase_coprocessor_region_classes:
-        coprocessorRegionClassList = hbase_coprocessor_region_classes.split(',')
-      else:
-        coprocessorRegionClassList = []
       if 'kerberos' == services['configurations']['hbase-site']['properties']['hbase.security.authentication'].lower():
         if 'org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint' not in coprocessorRegionClassList:
           coprocessorRegionClassList.append('org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint')
-          putHbaseProperty('hbase.coprocessor.region.classes', ','.join(coprocessorRegionClassList))
         if 'org.apache.hadoop.hbase.security.token.TokenProvider' not in coprocessorRegionClassList:
           coprocessorRegionClassList.append('org.apache.hadoop.hbase.security.token.TokenProvider')
-          putHbaseProperty('hbase.coprocessor.region.classes', ','.join(coprocessorRegionClassList))
       else:
         if 'org.apache.hadoop.hbase.security.token.TokenProvider' in coprocessorRegionClassList:
           coprocessorRegionClassList.remove('org.apache.hadoop.hbase.security.token.TokenProvider')
-          putHbaseProperty('hbase.coprocessor.region.classes', ','.join(coprocessorRegionClassList))
+
+    #Remove duplicates
+    uniqueCoprocessorRegionClassList = []
+    [uniqueCoprocessorRegionClassList.append(i) for i in coprocessorRegionClassList if not
uniqueCoprocessorRegionClassList.count(i)]
+    putHbaseProperty('hbase.coprocessor.region.classes', ','.join(set(uniqueCoprocessorRegionClassList)))
 
 
   def recommendTezConfigurations(self, configurations, clusterData, services, hosts):

http://git-wip-us.apache.org/repos/asf/ambari/blob/43747102/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 2837e66..45614a1 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
@@ -1759,7 +1759,7 @@ class TestHDP22StackAdvisor(TestCase):
     self.stackAdvisor.recommendHbaseEnvConfigurations(configurations, clusterData, None,
None)
     self.assertEquals(configurations, expected)
 
-  def disabled_test_recommendHbaseSiteConfigurations(self):
+  def test_recommendHbaseSiteConfigurations(self):
     servicesList = ["HBASE"]
     configurations = {}
     components = []
@@ -1872,7 +1872,7 @@ class TestHDP22StackAdvisor(TestCase):
 
     # Test when hbase.security.authentication = kerberos
     services['configurations']['hbase-site']['properties']['hbase.security.authentication']
= 'kerberos'
-    expected['hbase-site']['properties']['hbase.coprocessor.region.classes'] = 'org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint,org.apache.hadoop.hbase.security.token.TokenProvider'
+    expected['hbase-site']['properties']['hbase.coprocessor.region.classes'] = 'org.apache.hadoop.hbase.security.token.TokenProvider,org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint'
     self.stackAdvisor.recommendHBASEConfigurations(configurations, clusterData, services,
None)
     self.assertEquals(configurations, expected)
 
@@ -1886,16 +1886,17 @@ class TestHDP22StackAdvisor(TestCase):
     configurations['hbase-site']['properties'].pop('hbase.coprocessor.region.classes', None)
     services['configurations']['hbase-site']['properties']['hbase.security.authentication']
= 'kerberos'
     services['configurations']['hbase-site']['properties']['hbase.coprocessor.region.classes']
= 'a.b.c.d'
-    expected['hbase-site']['properties']['hbase.coprocessor.region.classes'] = 'a.b.c.d,org.apache.hadoop.hbase.security.token.TokenProvider'
+    expected['hbase-site']['properties']['hbase.coprocessor.region.classes'] = 'a.b.c.d,org.apache.hadoop.hbase.security.token.TokenProvider,org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint'
     self.stackAdvisor.recommendHBASEConfigurations(configurations, clusterData, services,
None)
     self.assertEquals(configurations, expected)
 
     # Test when hbase.security.authentication = kerberos AND authorization = true
     configurations['hbase-site']['properties'].pop('hbase.coprocessor.region.classes', None)
+    services['configurations']['hbase-site']['properties'].pop('hbase.coprocessor.region.classes',
None)
     services['configurations']['hbase-site']['properties']['hbase.security.authentication']
= 'kerberos'
     services['configurations']['hbase-site']['properties']['hbase.security.authorization']
= 'true'
     expected['hbase-site']['properties']['hbase.coprocessor.master.classes'] = "org.apache.hadoop.hbase.security.access.AccessController"
-    expected['hbase-site']['properties']['hbase.coprocessor.region.classes'] = 'org.apache.hadoop.hbase.security.access.AccessController,org.apache.hadoop.hbase.security.token.TokenProvider'
+    expected['hbase-site']['properties']['hbase.coprocessor.region.classes'] = 'org.apache.hadoop.hbase.security.access.AccessController,org.apache.hadoop.hbase.security.token.TokenProvider,org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint'
     expected['hbase-site']['properties']['hbase.coprocessor.regionserver.classes'] = "org.apache.hadoop.hbase.security.access.AccessController"
     self.stackAdvisor.recommendHBASEConfigurations(configurations, clusterData, services,
None)
     self.assertEquals(configurations, expected)


Mime
View raw message