浏览代码

Merge branch 'hotfix-1.0.8' into stable

Bertrand Gouny 10 年之前
父节点
当前提交
bf4b8efeaa
共有 3 个文件被更改,包括 23 次插入8 次删除
  1. 3 0
      CHANGELOG.md
  2. 1 1
      Makefile
  3. 19 7
      image/service/slapd/container-start.sh

+ 3 - 0
CHANGELOG.md

@@ -1,5 +1,8 @@
 # Changelog
 
+## 1.0.8
+  - Fix an other startup bug ! whuhu
+
 ## 1.0.7
   - Fix startup bug
 

+ 1 - 1
Makefile

@@ -1,5 +1,5 @@
 NAME = osixia/openldap
-VERSION = 1.0.7
+VERSION = 1.0.8
 
 .PHONY: all build test tag_latest release
 

+ 19 - 7
image/service/slapd/container-start.sh

@@ -103,21 +103,33 @@ EOF
   fi
 
   # start OpenLDAP
-  echo "Starting openldap..."
+
+
+  function startOpenLDAP(){
+
+    if [ -n "$PREVIOUS_HOSTNAME" ]; then
+      PREVIOUS_HOSTNAME="ldap://$PREVIOUS_HOSTNAME"
+    fi
+
+    #start openldap normaly
+    echo "Starting openldap..."
+    slapd -h "ldap://$HOSTNAME $PREVIOUS_HOSTNAME ldap://localhost ldapi:///" -u openldap -g openldap
+    echo "[ok]"
+  }
 
   # start OpenLDAP with previous replication configuration
   if [ -e "$WAS_STARTED_WITH_REPLICATION" ]; then
 
     . $WAS_STARTED_WITH_REPLICATION
-    echo "127.0.0.2 $PREVIOUS_HOSTNAME" >> /etc/hosts
 
-    slapd -h "ldap://$HOSTNAME ldap://$PREVIOUS_HOSTNAME ldap://localhost ldapi:///" -u openldap -g openldap
-  else
-    #start openldap normaly
-    slapd -h "ldap://$HOSTNAME ldap://localhost ldapi:///" -u openldap -g openldap
+    if [ "$PREVIOUS_HOSTNAME" != "$HOSTNAME" ]; then
+      echo "127.0.0.2 $PREVIOUS_HOSTNAME" >> /etc/hosts
+    else
+      PREVIOUS_HOSTNAME=""
+    fi
   fi
 
-  echo "[ok]"
+  startOpenLDAP
 
   # set bootstrap config part 2
   if $BOOTSTRAP; then