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 2014/12/05 19:33:46 UTC

ambari git commit: AMBARI-8565. Default install on Default Centos 6 fails with sudo tty not enabled. (aonishuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk 38b798b15 -> 4d783d809


AMBARI-8565. Default install on Default Centos 6 fails with sudo tty not enabled. (aonishuk)


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

Branch: refs/heads/trunk
Commit: 4d783d809334ce61d284fd2f980a5f01f975eaed
Parents: 38b798b
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Dec 5 20:33:38 2014 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Dec 5 20:33:38 2014 +0200

----------------------------------------------------------------------
 ambari-agent/conf/unix/ambari-agent      | 12 ++++++------
 ambari-agent/conf/unix/install-helper.sh |  3 +++
 ambari-agent/etc/sudoers.d/ambari-agent  |  1 +
 ambari-agent/pom.xml                     | 22 ++++++++++++++++++++++
 4 files changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4d783d80/ambari-agent/conf/unix/ambari-agent
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent
index 49567ac..09808f3 100755
--- a/ambari-agent/conf/unix/ambari-agent
+++ b/ambari-agent/conf/unix/ambari-agent
@@ -48,6 +48,12 @@ AMBARI_AGENT_PY_SCRIPT=/usr/lib/python2.6/site-packages/ambari_agent/AmbariAgent
 OK=1
 NOTOK=0
 
+sudo -v
+if [ "$?" != "0" ]; then
+ echo "You can't perform this operation as non-sudoer user. Please, re-login as one"
+ exit 0
+fi
+
 current_user=`awk -v val=$EUID -F ":" '$3==val{print $1}' /etc/passwd`
 # setup necessary ownership
 sudo chown -R $current_user "/var/lib/ambari-agent/ambari-env.sh"
@@ -113,12 +119,6 @@ check_python_version ()
 
 retcode=0
 
-sudo -v
-if [ "$?" != "0" ]; then
- echo "You can't perform this operation as non-sudoer user. Please, re-login as one"
- exit 0
-fi
-
 case "$1" in
   start)
         check_python_version

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d783d80/ambari-agent/conf/unix/install-helper.sh
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/install-helper.sh b/ambari-agent/conf/unix/install-helper.sh
index 3f47a79..c50e744 100644
--- a/ambari-agent/conf/unix/install-helper.sh
+++ b/ambari-agent/conf/unix/install-helper.sh
@@ -29,6 +29,7 @@ JINJA_AGENT_DIR="/usr/lib/ambari-agent/lib/ambari_jinja2"
 
 PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap"
 PYTHON_WRAPER_SOURCE="/var/lib/ambari-agent/ambari-python-wrap"
+SUDOERS_FILE="/etc/sudoers.d/ambari-agent"
 
 do_install(){
   # setting ambari_commons shared resource
@@ -48,6 +49,8 @@ do_install(){
   if [ ! -f "$PYTHON_WRAPER_TARGET" ]; then
     ln -s "$PYTHON_WRAPER_SOURCE" "$PYTHON_WRAPER_TARGET"
   fi
+  
+  chmod 440 "$SUDOERS_FILE"
 }
 
 do_remove(){

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d783d80/ambari-agent/etc/sudoers.d/ambari-agent
----------------------------------------------------------------------
diff --git a/ambari-agent/etc/sudoers.d/ambari-agent b/ambari-agent/etc/sudoers.d/ambari-agent
new file mode 100644
index 0000000..1663152
--- /dev/null
+++ b/ambari-agent/etc/sudoers.d/ambari-agent
@@ -0,0 +1 @@
+Defaults:root !requiretty

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d783d80/ambari-agent/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index a613141..034fdb9 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -50,6 +50,7 @@
     <target.cache.dir>${project.build.directory}/cache/</target.cache.dir>
     <resource.keeper.script>${ambari.server.module}/src/main/python/ambari_server/resourceFilesKeeper.py</resource.keeper.script>
     <init.d.dir>/etc/rc.d/init.d</init.d.dir>
+    <sudoers.d.dir>/etc/sudoers.d</sudoers.d.dir>
   </properties>
   <build>
     <plugins>
@@ -369,6 +370,16 @@
               </sources>
             </mapping>
             <mapping>
+              <directory>${sudoers.d.dir}</directory>
+              <username>root</username>
+              <groupname>root</groupname>
+              <sources>
+                <source>
+                  <location>etc/sudoers.d</location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
               <directory>/var/lib/${project.artifactId}/data</directory>
               <filemode>755</filemode>
               <username>root</username>
@@ -454,6 +465,16 @@
                   <filemode>755</filemode>
               </mapper>
             </data>
+           <data>
+              <src>etc/sudoers.d/ambari-agent</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>${sudoers.d.dir}</prefix>
+                  <user>root</user>
+                  <group>root</group>
+              </mapper>
+            </data>
             <data>
               <src>${basedir}/target/src/ambari-agent</src>
               <type>file</type>
@@ -641,6 +662,7 @@
             <exclude>src/test/python/ambari_agent/dummy*.txt</exclude>
             <exclude>src/main/python/ambari_agent/imports.txt</exclude>
             <exclude>src/main/python/ambari_agent/apscheduler/**</exclude>
+            <exclude>etc/sudoers.d/ambari-agent</exclude>
             <exclude>**/*.erb</exclude>
             <exclude>**/*.json</exclude>
             <exclude>**/*.pydevproject</exclude>