You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by to...@apache.org on 2010/12/22 22:54:01 UTC

svn commit: r1052078 - in /incubator/whirr/trunk: CHANGES.txt scripts/apache/zookeeper/post-configure

Author: tomwhite
Date: Wed Dec 22 21:54:01 2010
New Revision: 1052078

URL: http://svn.apache.org/viewvc?rev=1052078&view=rev
Log:
WHIRR-174. Fix ZooKeeper to allow stand-alone mode setups. Contributed by Lars George.

Modified:
    incubator/whirr/trunk/CHANGES.txt
    incubator/whirr/trunk/scripts/apache/zookeeper/post-configure

Modified: incubator/whirr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/CHANGES.txt?rev=1052078&r1=1052077&r2=1052078&view=diff
==============================================================================
--- incubator/whirr/trunk/CHANGES.txt (original)
+++ incubator/whirr/trunk/CHANGES.txt Wed Dec 22 21:54:01 2010
@@ -30,6 +30,9 @@ Trunk (unreleased changes)
 
     WHIRR-166. Improve docs regarding private keys. (Stu Hood via tomwhite)
 
+    WHIRR-174. Fix ZooKeeper to allow stand-alone mode setups.
+    (Lars George via tomwhite)
+
   BUG FIXES
 
     WHIRR-128. Fix DNS resolution for clients running within EC2.

Modified: incubator/whirr/trunk/scripts/apache/zookeeper/post-configure
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/scripts/apache/zookeeper/post-configure?rev=1052078&r1=1052077&r2=1052078&view=diff
==============================================================================
--- incubator/whirr/trunk/scripts/apache/zookeeper/post-configure (original)
+++ incubator/whirr/trunk/scripts/apache/zookeeper/post-configure Wed Dec 22 21:54:01 2010
@@ -63,21 +63,22 @@ clientPort=2181
 # The servers in the ensemble
 EOF
 
-id=1
-for server in "$@"; do
-  if [ $server == $SELF_HOST ]; then
-    myid=$id
-  fi
-  echo "server.$id=$server:2888:3888" >> $config_file
-  id=$((id+1))
-done
+if [[ $# -gt 1 ]]; then
+  id=1
+  for server in "$@"; do
+    if [ $server == $SELF_HOST ]; then
+      myid=$id
+    fi
+    echo "server.$id=$server:2888:3888" >> $config_file
+    id=$((id+1))
+  done
 
-if [ -z $myid ]; then
-  echo "Could not determine id for my host $SELF_HOST against servers $@."
-  exit 1
+  if [ -z $myid ]; then
+    echo "Could not determine id for my host $SELF_HOST against servers $@."
+    exit 1
+  fi
+  echo $myid > $myid_file
 fi
 
-echo $myid > $myid_file
-
 # Now that it's configured, start ZooKeeper
 nohup /etc/rc.local &
\ No newline at end of file