ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [1/2] ambari git commit: AMBARI-11948. If couple of users have the same UID as root (or amari user) ambari-agent fails to start (aonishuk)
Date Tue, 16 Jun 2015 13:58:01 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 8cf944bbf -> 66eecc810
  refs/heads/trunk 058983f10 -> 67add3fd3


AMBARI-11948. If couple of users have the same UID as root (or amari user) ambari-agent fails
to start (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/67add3fd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/67add3fd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/67add3fd

Branch: refs/heads/trunk
Commit: 67add3fd3bd02853bb8a62cf2d6d9a0e9d4a9654
Parents: 058983f
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Tue Jun 16 16:57:52 2015 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Tue Jun 16 16:57:52 2015 +0300

----------------------------------------------------------------------
 ambari-agent/conf/unix/ambari-agent | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/67add3fd/ambari-agent/conf/unix/ambari-agent
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent
index bc61af2..2d38067 100755
--- a/ambari-agent/conf/unix/ambari-agent
+++ b/ambari-agent/conf/unix/ambari-agent
@@ -48,10 +48,10 @@ AMBARI_AGENT_PY_SCRIPT=/usr/lib/python2.6/site-packages/ambari_agent/AmbariAgent
 OK=1
 NOTOK=0
 
-current_user=`awk -v val=$EUID -F ":" '$3==val{print $1}' /etc/passwd`
+current_user=`id -u -n`
 echo "" | sudo -S -l > /dev/null 2>&1
-if [ "$?" != "0" ] && [ "$current_user" != "root" ] ; then
- echo "You can't perform this operation as non-sudoer user. Please, re-login as one"
+if [ "$?" != "0" ] && [ "$EUID" -ne 0 ] ; then
+ echo "You can't perform this operation as non-sudoer user. Please, re-login or configure
sudo access for this user."
  exit 0
 fi
 


Mime
View raw message