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-21379. Ambari Agent doesn't start as non-root user with "ambari-agent start" logged in as root (aonishuk)
Date Fri, 30 Jun 2017 11:55:20 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 2f162cace -> f8d01eba9
  refs/heads/trunk d7c59fca1 -> ae6b74f38


AMBARI-21379. Ambari Agent doesn't start as non-root user with "ambari-agent start" logged
in as root (aonishuk)


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

Branch: refs/heads/trunk
Commit: ae6b74f38885967bde2ec3c4eca911cadcdcb295
Parents: d7c59fc
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Fri Jun 30 14:51:42 2017 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Fri Jun 30 14:51:42 2017 +0300

----------------------------------------------------------------------
 ambari-agent/conf/unix/install-helper.sh  |  8 ++++++++
 ambari-agent/etc/init.d/ambari-agent      | 22 +---------------------
 ambari-agent/pom.xml                      | 11 -----------
 ambari-agent/src/packages/tarball/all.xml |  2 +-
 4 files changed, 10 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ae6b74f3/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 c30aab1..37bbe4a 100644
--- a/ambari-agent/conf/unix/install-helper.sh
+++ b/ambari-agent/conf/unix/install-helper.sh
@@ -31,6 +31,8 @@ SIMPLEJSON_AGENT_DIR="/usr/lib/ambari-agent/lib/ambari_simplejson"
 AMBARI_AGENT="/usr/lib/python2.6/site-packages/ambari_agent"
 PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap"
 AMBARI_AGENT_VAR="/var/lib/ambari-agent"
+AMBARI_AGENT_BINARY="/etc/init.d/ambari-agent"
+AMBARI_AGENT_BINARY_SYMLINK="/usr/sbin/ambari-agent"
 
 clean_pyc_files(){
   # cleaning old *.pyc files
@@ -46,6 +48,10 @@ do_install(){
     cp -f /etc/ambari-agent/conf.save/* /etc/ambari-agent/conf
     mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save
   fi
+
+  # setting up /usr/sbin/ambari-agent symlink
+  rm -f "$AMBARI_AGENT_BINARY_SYMLINK"
+  ln -s "$AMBARI_AGENT_BINARY" "$AMBARI_AGENT_BINARY_SYMLINK"
     
   # setting ambari_commons shared resource
   rm -rf "$OLD_COMMON_DIR"
@@ -125,6 +131,8 @@ do_remove(){
 
   clean_pyc_files
 
+  rm -f "$AMBARI_AGENT_BINARY_SYMLINK"
+
   if [ -d "/etc/ambari-agent/conf.save" ]; then
     mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save
   fi

http://git-wip-us.apache.org/repos/asf/ambari/blob/ae6b74f3/ambari-agent/etc/init.d/ambari-agent
----------------------------------------------------------------------
diff --git a/ambari-agent/etc/init.d/ambari-agent b/ambari-agent/etc/init.d/ambari-agent
index 044f86d..b70de85 100644
--- a/ambari-agent/etc/init.d/ambari-agent
+++ b/ambari-agent/etc/init.d/ambari-agent
@@ -36,26 +36,6 @@ else
   command_prefx="bash -c"
 fi
 
-case "$1" in
-  start)
-        $command_prefx "/usr/sbin/ambari-agent $@"
-        ;;
-  stop)
-        $command_prefx "/usr/sbin/ambari-agent $@"
-        ;;
-  status)
-        $command_prefx "/usr/sbin/ambari-agent $@"
-        ;;
-  restart)
-        $command_prefx "$0 stop"
-        $command_prefx "$0 start"
-        ;;
-  reset)
-        /usr/sbin/ambari-agent $@
-        ;;
-  *)
-        echo "Usage: $0 {start|stop|status|restart|reset <server_hostname>}"
-        exit 1
-esac
+$command_prefx "/var/lib/ambari-agent/bin/ambari-agent $@"
 
 exit $?

http://git-wip-us.apache.org/repos/asf/ambari/blob/ae6b74f3/ambari-agent/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index f2add9a..8673f2e 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -274,17 +274,6 @@
               </sources>
             </mapping>
            <mapping>
-              <directory>/usr/sbin</directory>
-              <username>root</username>
-              <groupname>root</groupname>
-              <directoryIncluded>false</directoryIncluded> <!-- avoid managing
/usr/sbin -->
-              <sources>
-                <source>
-                  <location>${project.build.directory}${dirsep}${project.artifactId}-${project.version}/usr/sbin</location>
-                </source>
-              </sources>
-            </mapping>
-           <mapping>
               <directory>/usr/lib/ambari-agent</directory>
               <filemode>755</filemode>
               <username>root</username>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ae6b74f3/ambari-agent/src/packages/tarball/all.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/src/packages/tarball/all.xml b/ambari-agent/src/packages/tarball/all.xml
index c71ffe9..b0c2f1c 100644
--- a/ambari-agent/src/packages/tarball/all.xml
+++ b/ambari-agent/src/packages/tarball/all.xml
@@ -176,7 +176,7 @@
     <file>
       <fileMode>755</fileMode>
       <source>${basedir}/target/src/ambari-agent</source>
-      <outputDirectory>/usr/sbin</outputDirectory>
+      <outputDirectory>/var/lib/ambari-agent/bin</outputDirectory>
     </file>
     <file>
       <fileMode>700</fileMode>


Mime
View raw message