Browse Source

AMBARI-25833: An error occurs when HBase service check is run for the first time after Kerberos is enabled (#3623)

Yu Hou 2 năm trước cách đây
mục cha
commit
3c41f479c1

+ 6 - 4
ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/service_check.py

@@ -70,16 +70,18 @@ class HbaseServiceCheckDefault(HbaseServiceCheck):
     
     if params.security_enabled:    
       hbase_grant_premissions_file = format("{exec_tmp_dir}/hbase_grant_permissions.sh")
-      grantprivelegecmd = format("{kinit_cmd} {hbase_cmd} shell {hbase_grant_premissions_file}")
-  
+      grantprivelegecmd = format("{kinit_cmd} {hbase_grant_premissions_file}")
+
       File( hbase_grant_premissions_file,
         owner   = params.hbase_user,
         group   = params.user_group,
-        mode    = 0644,
+        mode    = 0755,
         content = Template('hbase_grant_permissions.j2')
       )
-      
+
       Execute( grantprivelegecmd,
+        tries     = 6,
+        try_sleep = 5,
         user = params.hbase_user,
         logoutput = True
       )

+ 9 - 2
ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/templates/hbase_grant_permissions.j2

@@ -15,6 +15,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #}
+#!/usr/bin/env bash
 
 #
 # Licensed to the Apache Software Foundation (ASF) under one
@@ -35,5 +36,11 @@
 # under the License.
 #
 #
-grant '{{smoke_test_user}}', '{{smokeuser_permissions}}'
-exit
+
+echo "grant '{{smoke_test_user}}', '{{smokeuser_permissions}}'" | {{hbase_cmd}} --config {{hbase_conf_dir}} shell > {{exec_tmp_dir}}/hbase_grant_result
+cat {{exec_tmp_dir}}/hbase_grant_result
+tr -d '\n|\t| ' < {{exec_tmp_dir}}/hbase_grant_result | grep -q ERROR
+if [ "$?" -eq 0 ]
+then
+  exit 1
+fi