Преглед на файлове

AMBARI-2073. After Ambari upgrade to 1.2.3, MapReduce service check fails because uid of ambari_qa changed. (swagle)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1478986 13f79535-47bb-0310-9956-ffa450edef68
Siddharth Wagle преди 12 години
родител
ревизия
6c8f4d5cc9
променени са 3 файла, в които са добавени 46 реда и са изтрити 3 реда
  1. 3 0
      CHANGES.txt
  2. 30 0
      ambari-agent/src/main/puppet/modules/hdp/files/changeUid.sh
  3. 13 3
      ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp

+ 3 - 0
CHANGES.txt

@@ -828,6 +828,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2073. After Ambari upgrade to 1.2.3, MapReduce service check fails 
+ because uid of ambari_qa changed. (swagle)
+
  AMBARI-2067. hive-site.xml cannot be readonly for clients. (swagle)
 
  AMBARI-2068. "Preparing to install <component>" message needs spacing.

+ 30 - 0
ambari-agent/src/main/puppet/modules/hdp/files/changeUid.sh

@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+#
+# 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.
+#
+
+username=$1
+newUid=$2
+dirs=$3
+
+dir_array=($(echo $dirs | sed 's/,/\n/g'))
+old_uid=$(id -u $username)
+echo "Changing uid of $username from $old_uid to $newUid"
+echo "Changing directory permisions for ${dir_array[@]}"
+usermod -u $newUid $username && for dir in ${dir_array[@]} ; do chown -Rh $newUid $dir ; done

+ 13 - 3
ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp

@@ -153,15 +153,25 @@ class hdp::create_smoke_user()
 
   ## Set smoke user uid to > 1000 for enable security feature
   $secure_uid = $hdp::params::smoketest_user_secure_uid
-  $cmd_set_uid = "usermod -u ${secure_uid} ${smoke_user}"
+  $changeUid_path = "/tmp/changeUid.sh"
+  $smoke_user_dirs = "/tmp/${smoke_user},/home/${smoke_user},/var/spool/mail/${smoke_user}"
+  $cmd_set_uid = "$changeUid_path ${smoke_user} ${secure_uid} ${smoke_user_dirs}"
   $cmd_set_uid_check = "id -u ${smoke_user} | grep ${secure_uid}"
+
+  file { $changeUid_path :
+    ensure => present,
+    source => "puppet:///modules/hdp/changeUid.sh",
+    mode => '0755'
+  }
+
   hdp::exec{ $cmd_set_uid:
    command => $cmd_set_uid,
    unless => $cmd_set_uid_check,
-   require => Hdp::User[$smoke_user]
+   require => File[$changeUid_path]
   }
 
-  Group<|title == $smoke_group or title == $proxyuser_group|> -> Hdp::User[$smoke_user] 
+  Group<|title == $smoke_group or title == $proxyuser_group|> ->
+  Hdp::User[$smoke_user] -> Hdp::Exec[$cmd_set_uid]
 }