This is an automated email from the ASF dual-hosted git repository.

wuzhiguo pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 3c41f479c1 AMBARI-25833: An error occurs when HBase service check is 
run for the first time after Kerberos is enabled (#3623)
3c41f479c1 is described below

commit 3c41f479c149fca4f680b0bd6d12ad1cee9586d6
Author: Yu Hou <[email protected]>
AuthorDate: Thu Jan 19 21:54:35 2023 +0800

    AMBARI-25833: An error occurs when HBase service check is run for the first 
time after Kerberos is enabled (#3623)
---
 .../3.2.0/services/HBASE/package/scripts/service_check.py     | 10 ++++++----
 .../HBASE/package/templates/hbase_grant_permissions.j2        | 11 +++++++++--
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git 
a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/service_check.py
 
b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/service_check.py
index 5184ea7316..f54b29f5b6 100755
--- 
a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/service_check.py
+++ 
b/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
       )
diff --git 
a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/templates/hbase_grant_permissions.j2
 
b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/templates/hbase_grant_permissions.j2
index 33789839fc..ff3bb72107 100755
--- 
a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/templates/hbase_grant_permissions.j2
+++ 
b/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
\ No newline at end of file
+
+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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to