Author: swagle
Date: Fri May  3 21:45:56 2013
New Revision: 1478986

URL: http://svn.apache.org/r1478986
Log:
AMBARI-2073. After Ambari upgrade to 1.2.3, MapReduce service check fails 
because uid of ambari_qa changed. (swagle)

Added:
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/files/
    
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/files/changeUid.sh
Modified:
    incubator/ambari/trunk/CHANGES.txt
    
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp

Modified: incubator/ambari/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1478986&r1=1478985&r2=1478986&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri May  3 21:45:56 2013
@@ -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.

Added: 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/files/changeUid.sh
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/files/changeUid.sh?rev=1478986&view=auto
==============================================================================
--- 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/files/changeUid.sh
 (added)
+++ 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/files/changeUid.sh
 Fri May  3 21:45:56 2013
@@ -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
\ No newline at end of file

Modified: 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp?rev=1478986&r1=1478985&r2=1478986&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp
 (original)
+++ 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp
 Fri May  3 21:45:56 2013
@@ -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]
 }
 
 


Reply via email to