summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/eventscripts/stubs
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-01-28 16:08:50 +1100
committerAmitay Isaacs <amitay@samba.org>2014-02-13 02:03:24 +0100
commita226015990356ee989c5b9a472581bb3187de894 (patch)
tree5e52e8bccb0330d4b298f00c9461bf7a86178776 /ctdb/tests/eventscripts/stubs
parent176ae6c704528c021fcc34a41878584f43a00119 (diff)
downloadsamba-a226015990356ee989c5b9a472581bb3187de894.tar.gz
samba-a226015990356ee989c5b9a472581bb3187de894.tar.xz
samba-a226015990356ee989c5b9a472581bb3187de894.zip
ctdb-tests-eventscripts: Testing support for promote_secondaries
Just enable this behaviour by default in the ip command stub, since 10.interface assumes/sets it. The rc.local replacement for set_proc() doesn't do anything... Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tests/eventscripts/stubs')
-rwxr-xr-xctdb/tests/eventscripts/stubs/ip11
1 files changed, 9 insertions, 2 deletions
diff --git a/ctdb/tests/eventscripts/stubs/ip b/ctdb/tests/eventscripts/stubs/ip
index f076cb9b5f..860f6a5408 100755
--- a/ctdb/tests/eventscripts/stubs/ip
+++ b/ctdb/tests/eventscripts/stubs/ip
@@ -1,5 +1,7 @@
#!/bin/sh
+promote_secondaries=true
+
not_implemented ()
{
echo "ip stub command: \"$1\" not implemented"
@@ -305,8 +307,13 @@ ip_addr_del ()
echo "RTNETLINK answers: Cannot assign requested address" >&2
exit 254
elif grep -Fq "$local" "$pf" ; then
- # Remove primaries AND SECONDARIES.
- rm -f "$pf" "$sf"
+ if $promote_secondaries && [ -s "$sf" ] ; then
+ head -n 1 "$sf" >"$pf"
+ sed -i -e '1d' "$sf"
+ else
+ # Remove primaries AND SECONDARIES.
+ rm -f "$pf" "$sf"
+ fi
elif [ -f "$sf" ] && grep -Fq "$local" "$sf" ; then
grep -Fv "$local" "$sf" >"${sf}.new"
mv "${sf}.new" "$sf"