Prechádzať zdrojové kódy

AMBARI-2518. Webhcat start failed. Additional fixes. (swagle)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1497669 13f79535-47bb-0310-9956-ffa450edef68
Siddharth Wagle 12 rokov pred
rodič
commit
368800f099

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

@@ -368,6 +368,7 @@ define hdp-hadoop::exec-hadoop(
   $security_enabled = $hdp::params::security_enabled
   $conf_dir = $hdp-hadoop::params::conf_dir
   $hdfs_user = $hdp-hadoop::params::hdfs_user
+  $hbase_user = $hdp-hadoop::params::hbase_user
 
   if ($user == undef) {
     $run_user = $hdfs_user
@@ -379,19 +380,30 @@ define hdp-hadoop::exec-hadoop(
     if ($run_user in [$hdfs_user,'root']) {
       $keytab = "${hdp::params::keytab_path}/hdfs.headless.keytab"
       $principal = $hdfs_user
-    }  else {
+    } elsif ($run_user in [$hbase_user]) {
+      $keytab = "${hdp::params::keytab_path}/hbase.headless.keytab"
+      $principal = $hbase_user
+    } else {
       $keytab = $hdp::params::smokeuser_keytab
       $principal = $hdp::params::smokeuser
     }
-    $kinit_if_needed = "${kinit_path_local} -kt ${keytab} ${principal}; "
+    $kinit_if_needed = "su - ${run_user} -c '${kinit_path_local} -kt ${keytab} ${principal}'"
   } else {
     $kinit_if_needed = ""
   }
- 
+
   if ($echo_yes == true) {
-    $cmd = "${kinit_if_needed}yes Y | hadoop --config ${conf_dir} ${command}"
+    $cmd = "yes Y | hadoop --config ${conf_dir} ${command}"
   } else {
-    $cmd = "${kinit_if_needed}hadoop --config ${conf_dir} ${command}"
+    $cmd = "hadoop --config ${conf_dir} ${command}"
+  }
+
+  if ($kinit_if_needed != "") {
+    exec { "kinit_before_${cmd}":
+      command => $kinit_if_needed,
+      path => ['/bin'],
+      before => Hdp::Exec[$cmd]
+    }
   }
 
   hdp::exec { $cmd:

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

@@ -88,7 +88,7 @@ class hdp-hbase::hbase::service_check() inherits hdp-hbase::params
       mode => '0644',
       content => template('hdp-hbase/hbase_grant_permissions.erb')
       }
-      hdp::exec { '${smokeuser}_grant_privileges' :
+      hdp-hadoop::exec-hadoop { '${smokeuser}_grant_privileges' :
         command => $grantprivelegecmd,
         require => File[$hbase_grant_premissions_file],
         user => $hbase_user