You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 10:49:02 UTC

svn commit: r1132133 - in /incubator/mesos/trunk/src/deploy: mesos-env.sh start-slaves stop-slaves

Author: benh
Date: Sun Jun  5 08:49:01 2011
New Revision: 1132133

URL: http://svn.apache.org/viewvc?rev=1132133&view=rev
Log:
Added a deploy_with_sudo config parameter that tells the deploy scripts
whether to run slaves as the user who launched start-mesos or whether to
sudo and run them as root (provided the user has passwordless sudo access).

Modified:
    incubator/mesos/trunk/src/deploy/mesos-env.sh
    incubator/mesos/trunk/src/deploy/start-slaves
    incubator/mesos/trunk/src/deploy/stop-slaves

Modified: incubator/mesos/trunk/src/deploy/mesos-env.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/deploy/mesos-env.sh?rev=1132133&r1=1132132&r2=1132133&view=diff
==============================================================================
--- incubator/mesos/trunk/src/deploy/mesos-env.sh (original)
+++ incubator/mesos/trunk/src/deploy/mesos-env.sh Sun Jun  5 08:49:01 2011
@@ -31,6 +31,10 @@ if [ "x$MESOS_URL" == "x" ]; then
   MESOS_URL="mesos://1@$FIRST_MASTER:5050"
 fi
 
+# Read the deploy_with_sudo config setting to determine whether to run
+# slave daemons as sudo.
+DEPLOY_WITH_SUDO=`$MESOS_HOME/bin/mesos-getconf deploy_with_sudo`
+
 # Options for SSH
 SSH_OPTS="-o StrictHostKeyChecking=no -o ConnectTimeout=2"
 

Modified: incubator/mesos/trunk/src/deploy/start-slaves
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/deploy/start-slaves?rev=1132133&r1=1132132&r2=1132133&view=diff
==============================================================================
--- incubator/mesos/trunk/src/deploy/start-slaves (original)
+++ incubator/mesos/trunk/src/deploy/start-slaves Sun Jun  5 08:49:01 2011
@@ -5,11 +5,17 @@ DEPLOY_DIR=`cd "$DEPLOY_DIR"; pwd`
 
 cd $DEPLOY_DIR
 
+# Set SUDO_COMMAND to sudo if we should launch the slaves with sudo.
+SUDO_COMMAND=""
+if [ "$DEPLOY_WITH_SUDO" == "1" ]; then
+  SUDO_COMMAND="sudo"
+fi
+
 # Launch slaves
 for slave in $SLAVES; do
   echo "Starting slave on $slave"
-  echo ssh $SSH_OPTS $slave "$DEPLOY_DIR/mesos-daemon mesos-slave -u $MESOS_URL </dev/null >/dev/null" 
-  ssh $SSH_OPTS $slave "$DEPLOY_DIR/mesos-daemon mesos-slave -u $MESOS_URL </dev/null >/dev/null" &
+  echo ssh $SSH_OPTS $slave "$SUDO_COMMAND $DEPLOY_DIR/mesos-daemon mesos-slave -u $MESOS_URL </dev/null >/dev/null" 
+  ssh $SSH_OPTS $slave "$SUDO_COMMAND $DEPLOY_DIR/mesos-daemon mesos-slave -u $MESOS_URL </dev/null >/dev/null" &
   sleep 0.1
 done
 wait

Modified: incubator/mesos/trunk/src/deploy/stop-slaves
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/deploy/stop-slaves?rev=1132133&r1=1132132&r2=1132133&view=diff
==============================================================================
--- incubator/mesos/trunk/src/deploy/stop-slaves (original)
+++ incubator/mesos/trunk/src/deploy/stop-slaves Sun Jun  5 08:49:01 2011
@@ -6,9 +6,16 @@ DEPLOY_DIR=`cd "$DEPLOY_DIR"; pwd`
 
 cd $DEPLOY_DIR
 
+# Set SUDO_COMMAND to sudo if we launched the slave daemons with sudo,
+# so that we can kill them as sudo.
+SUDO_COMMAND=""
+if [ "$DEPLOY_WITH_SUDO" == "1" ]; then
+  SUDO_COMMAND="sudo"
+fi
+
 for slave in $SLAVES; do
   echo "Stopping slave on $slave"
-  ssh $SSH_OPTS $slave "killall mesos-slave" &
+  ssh $SSH_OPTS $slave "$SUDO_COMMAND killall mesos-slave" &
   sleep 0.1
 done
 wait