You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2013/04/01 23:25:13 UTC

svn commit: r1463304 - in /incubator/ambari/trunk: CHANGES.txt ambari-agent/src/main/puppet/modules/hdp-mysql/files/addMysqlUser.sh

Author: swagle
Date: Mon Apr  1 21:25:13 2013
New Revision: 1463304

URL: http://svn.apache.org/r1463304
Log:
AMBARI-1762. SUSE_Unable to start hive. (swagle)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-mysql/files/addMysqlUser.sh

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1463304&r1=1463303&r2=1463304&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Mon Apr  1 21:25:13 2013
@@ -541,6 +541,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1762. SUSE_Unable to start hive. (swagle)
+
  AMBARI-1761. Update the DDL update script to modify the table to
  include ph_cpu_count. (smohanty)
 

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-mysql/files/addMysqlUser.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-mysql/files/addMysqlUser.sh?rev=1463304&r1=1463303&r2=1463304&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-mysql/files/addMysqlUser.sh (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-mysql/files/addMysqlUser.sh Mon Apr  1 21:25:13 2013
@@ -24,6 +24,7 @@ mysqldservice=$1
 mysqldbuser=$2
 mysqldbpasswd=$3
 mysqldbhost=$4
+myhostname=$(hostname -f)
 
 service $mysqldservice start
 echo "Adding user $mysqldbuser@$mysqldbhost and $mysqldbuser@localhost"
@@ -31,5 +32,10 @@ mysql -u root -e "CREATE USER '$mysqldbu
 mysql -u root -e "CREATE USER '$mysqldbuser'@'localhost' IDENTIFIED BY '$mysqldbpasswd';"
 mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '$mysqldbuser'@'$mysqldbhost';"
 mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '$mysqldbuser'@'localhost';"
+if [ '$(mysql -u root -e "select user from mysql.user where user='$mysqldbuser' and host='$myhostname'" | grep "$mysqldbuser")' != '0' ]; then
+  echo "Adding user $mysqldbuser@$myhostname";
+  mysql -u root -e "CREATE USER '$mysqldbuser'@'$myhostname' IDENTIFIED BY '$mysqldbpasswd';";
+  mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '$mysqldbuser'@'$myhostname';";
+fi
 mysql -u root -e "flush privileges;"
 service $mysqldservice stop
\ No newline at end of file