Sfoglia il codice sorgente

AMBARI-2138. HBase smoke test fails on secure cluster. (swagle)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1482991 13f79535-47bb-0310-9956-ffa450edef68
Siddharth Wagle 12 anni fa
parent
commit
565cd54ed1

+ 2 - 0
CHANGES.txt

@@ -852,6 +852,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2138. HBase smoke test fails on secure cluster. (swagle)
+
  AMBARI-2136. Home paths are not set correctly in /etc/sqoop/conf/sqoop-env.sh
  (mahadev)
 

+ 5 - 5
ambari-agent/src/main/puppet/modules/hdp-hbase/files/hbaseSmoke.sh

@@ -18,9 +18,9 @@
 # under the License.
 #
 #
-disable 'usertable'
-drop 'usertable'
-create 'usertable','family'
-put 'usertable','row01','family:col01','value1'
-scan 'usertable'
+disable 'ambarismoketest'
+drop 'ambarismoketest'
+create 'ambarismoketest','family'
+put 'ambarismoketest','row01','family:col01','value1'
+scan 'ambarismoketest'
 exit

+ 1 - 1
ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/hbase/service_check.pp

@@ -22,7 +22,7 @@ class hdp-hbase::hbase::service_check()
 {
   $smoke_test_user = $hdp::params::smokeuser
 
-  $output_file = "/apps/hbase/data/usertable"
+  $output_file = "/apps/hbase/data/ambarismoketest"
   $conf_dir = $hdp::params::hbase_conf_dir
 
   $test_cmd = "fs -test -e ${output_file}" 

+ 19 - 1
ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/init.pp

@@ -28,7 +28,7 @@ class hdp-hbase(
   $config_dir = $hdp-hbase::params::conf_dir
   
   $hdp::params::component_exists['hdp-hbase'] = true
-
+  $smokeuser = $hdp::params::smokeuser
 
   #Configs generation  
 
@@ -102,6 +102,24 @@ class hdp-hbase(
     if ($security_enabled == true) {
       if ($type == 'master') {
         hdp-hbase::configfile { 'hbase_master_jaas.conf' : }
+
+        $hbase_grant_premissions_file = '/tmp/hbase_grant_permissions.sh'
+
+        file { $hbase_grant_premissions_file:
+          owner   => $hbase_user,
+          group   => $hdp::params::user_group,
+          mode => '0644',
+          content => template('hdp-hbase/hbase_grant_permissions.erb')
+        }
+
+        hdp::exec { '${smokeuser}_grant_privileges' :
+          command => "su - ${smoke_test_user} -c 'hbase --config $conf_dir shell ${hbase_grant_premissions_file}'",
+          require => File[$hbase_grant_premissions_file]
+        }
+
+        Hdp-hbase::Configfile<||> -> File[$hbase_grant_premissions_file] ->
+        Hdp::Exec['${smokeuser}_grant_privileges'] -> Anchor['hdp-hbase::end']
+
       } elsif ($type == 'regionserver') {
         hdp-hbase::configfile { 'hbase_regionserver_jaas.conf' : }
       } else {

+ 2 - 0
ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/params.pp

@@ -99,4 +99,6 @@ class hdp-hbase::params() inherits hdp::params
   } else {
     $hbase_jaas_princ = "${hbase_primary_name}@${kerberos_domain}"
   }
+
+  $smokeuser_permissions = hdp_default("smokeuser_permissions", "RWXCA")
 }

+ 20 - 0
ambari-agent/src/main/puppet/modules/hdp-hbase/templates/hbase_grant_permissions.erb

@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+grant '<%=scope.function_hdp_template_var("::hdp::params::smokeuser")%>', '<%=scope.function_hdp_template_var("::hdp-hbase::params::smokeuser_permissions")%>'