You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2015/09/16 19:19:46 UTC

[2/2] ambari git commit: AMBARI-13116. Extraneous ‘list’ command being invoked through sudo (aonishuk)

AMBARI-13116. Extraneous ‘list’ command being invoked through sudo (aonishuk)


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

Branch: refs/heads/branch-2.1
Commit: e1efd557e6ba3847298b6211ee4f150ec5565a54
Parents: b726df7
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Sep 16 20:19:08 2015 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Sep 16 20:19:08 2015 +0300

----------------------------------------------------------------------
 ambari-agent/conf/unix/ambari-agent | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e1efd557/ambari-agent/conf/unix/ambari-agent
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent
index 9659014..a08ead2 100755
--- a/ambari-agent/conf/unix/ambari-agent
+++ b/ambari-agent/conf/unix/ambari-agent
@@ -49,10 +49,13 @@ OK=1
 NOTOK=0
 
 current_user=`id -u -n`
-echo "" | sudo -S -l > /dev/null 2>&1
-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
+
+if [ "$EUID" -ne 0 ] ; then
+  echo "" | sudo -S -l > /dev/null 2>&1
+  if [ "$?" != "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
 fi
 
 keysdir=$(awk -F "=" '/keysdir/ {print $2}' /etc/ambari-agent/conf/ambari-agent.ini)