ctdb-tests: Fix a bug in the ctdb stub's moveip command
authorMartin Schwenke <martin@meltin.net>
Wed, 21 Mar 2018 04:42:22 +0000 (15:42 +1100)
committerAmitay Isaacs <amitay@samba.org>
Wed, 28 Mar 2018 00:57:16 +0000 (02:57 +0200)
This was writing garbage into the IP layout file and relevant tests
were passing by luck.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/eventscripts/stubs/ctdb

index 17a04767a7f71883823d8a7acfef057bdcfde3ab..0976a13790bd5c02b009bd1513508c510db9a427 100755 (executable)
@@ -241,9 +241,9 @@ ctdb_moveip ()
 
        while read _i _pnn ; do
            if [ "$_ip" = "$_i" ] ; then
-               echo "$_ip $_target"
+               echo "$_i $_target"
            else
-               echo "$_ip $_pnn"
+               echo "$_i $_pnn"
            fi
        done | sort >"$_t"
        mv "$_t" "$FAKE_CTDB_IP_LAYOUT"
@@ -486,7 +486,7 @@ case "$1" in
     pnn|xpnn)      ctdb_pnn ;;
     enable)        ctdb_enable "$@";;
     disable)       ctdb_disable "$@";;
-    moveip)        ctdb_moveip "$@";;
+    moveip) shift ; ctdb_moveip "$@";;
     shutdown)      ctdb_shutdown "$@";;
     setvar)       ctdb_setvar "$@" ;;
     nodestatus)           ctdb_nodestatus "$@" ;;