Browse Source

AMBARI-2608. WebHCat and Oozie services does not start on RHEL5 with enabled security because of - CRITICAL: Error doing kinit for nagios. (smohanty)

Sumit Mohanty 12 years ago
parent
commit
6928cf3ba6

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

@@ -387,7 +387,7 @@ define hdp-hadoop::exec-hadoop(
       $keytab = $hdp::params::smokeuser_keytab
       $principal = $hdp::params::smokeuser
     }
-    $kinit_if_needed = "su - ${run_user} -c '${kinit_path_local} -kt ${keytab} ${principal}'"
+    $kinit_if_needed = "su - ${run_user} -c '${hdp::params::kinit_path_local} -kt ${keytab} ${principal}'"
   } else {
     $kinit_if_needed = ""
   }

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

@@ -28,7 +28,7 @@ class hdp-hcat::hcat::service_check()
   $smoke_user_keytab = $hdp::params::smokeuser_keytab
 
   if ($security_enabled == true) {
-    $smoke_user_kinitcmd="${kinit_path_local} -kt ${smoke_user_keytab} ${smoke_test_user}; "
+    $smoke_user_kinitcmd="${hdp::params::kinit_path_local} -kt ${smoke_user_keytab} ${smoke_test_user}; "
   } else {
     $smoke_user_kinitcmd=""
   }

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

@@ -27,7 +27,7 @@ class hdp-sqoop::sqoop::service_check()
   $security_enabled=$hdp::params::security_enabled
   $smoke_user_keytab = $hdp::params::smokeuser_keytab
   if ($security_enabled == true) {
-    $smoke_user_kinitcmd="${kinit_path_local}  -kt ${smoke_user_keytab} ${smoke_test_user}; "
+    $smoke_user_kinitcmd="${hdp::params::kinit_path_local}  -kt ${smoke_user_keytab} ${smoke_test_user}; "
   } else {
     $smoke_user_kinitcmd=""
   }

+ 2 - 2
ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/templeton/service_check.pp

@@ -28,7 +28,7 @@ class hdp-templeton::templeton::service_check()
   } else {
     $security = "false"
   }
-  $kinit_path_local = $hdp::params::kinit_path_local
+  $kinit_path = $hdp::params::kinit_path_local
   $smoke_user_keytab = $hdp::params::smokeuser_keytab
 
   $templeton_host = $hdp::params::webhcat_server_host
@@ -51,7 +51,7 @@ define hdp-templeton::smoke_shell_file()
   }
 
   exec { '/tmp/templetonSmoke.sh':
-    command   => "sh /tmp/templetonSmoke.sh ${templeton_host} ${smoke_test_user} ${smoke_user_keytab} ${security} ${kinit_path_local}",
+    command   => "sh /tmp/templetonSmoke.sh ${templeton_host} ${smoke_test_user} ${smoke_user_keytab} ${security} ${kinit_path}",
     tries     => 3,
     try_sleep => 5,
     require   => File['/tmp/templetonSmoke.sh'],

+ 36 - 0
ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_get_kinit_path.rb

@@ -0,0 +1,36 @@
+#
+#
+# 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.
+#
+#
+#given set of paths find the first full path to knit
+module Puppet::Parser::Functions
+  newfunction(:hdp_get_kinit_path, :type => :rvalue) do |args|
+    kinit_path = ""
+    if args.length > 0
+      args.join(",").split(',').reject{|s| s.strip.length < 1}.each do |s|
+        path = File.join(s.strip, "kinit")
+        if File.exist?(path) and File.file?(path)
+          kinit_path = path
+          break
+        end
+      end
+    end
+    kinit_path
+  end
+end

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

@@ -52,7 +52,7 @@ class hdp::params()
   $kerberos_domain = hdp_default("kerberos_domain","EXAMPLE.COM")
   $smoketest_user_secure_uid = hdp_default("smoketest_user_secure_uid",1012)
   ## $smoketest_user_secure_uid = 1012
-  $kinit_path_local = hdp_default("kinit_path_local","/usr/bin/kinit")
+  $kinit_path_local = hdp_get_kinit_path(hdp_default("kinit_path_local"), "/usr/bin", "/usr/kerberos/bin", "/usr/sbin")
   $keytab_path = hdp_default("keytab_path", "/etc/security/keytabs")
   $use_hostname_in_principal = hdp_default("instance_name", true)
   $smokeuser_keytab = hdp_default("smokeuser_keytab", "/etc/security/keytabs/smokeuser.headless.keytab")