The master IP setup script now checks if the master IP is actually
configured on the machine before trying to remove the IP.

This fixes issue 460.

Signed-off-by: Thomas Thrainer <[email protected]>
---
 tools/master-ip-setup | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/master-ip-setup b/tools/master-ip-setup
index bad47d1..1be9fc4 100755
--- a/tools/master-ip-setup
+++ b/tools/master-ip-setup
@@ -62,6 +62,12 @@ start() {
 
 # Stop the master IP
 stop() {
+  if ! ip addr show dev $MASTER_NETDEV | \
+        grep "$MASTER_IP/$MASTER_NETMASK"  >/dev/null 2>&1; then
+    echo "Master IP address not configured on this machine. Doing nothing."
+    exit 0
+  fi
+
   if ! ip addr del $MASTER_IP/$MASTER_NETMASK dev $MASTER_NETDEV; then
     echo "Error during the deactivation of the master IP address" >&2
     exit 1
-- 
1.8.2.1

Reply via email to