From cb1e82debec45f53351098be5b44bb6fe762ad3e Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 27 Feb 2015 15:15:18 +1100 Subject: [PATCH] ctdb-tests: Extend ctdb stub to support "ip" with and without -X Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs (cherry picked from commit 2aeb518637af29da03984470d874b94dfb18e34e) --- ctdb/tests/eventscripts/stubs/ctdb | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/ctdb/tests/eventscripts/stubs/ctdb b/ctdb/tests/eventscripts/stubs/ctdb index 382d1d2fa62..7745dd92fa8 100755 --- a/ctdb/tests/eventscripts/stubs/ctdb +++ b/ctdb/tests/eventscripts/stubs/ctdb @@ -146,14 +146,18 @@ ctdb_ip () # If nobody has done any IP-fu then generate a layout. [ -f "$FAKE_CTDB_IP_LAYOUT" ] || ip_reallocate - if $verbose ; then - echo ":Public IP:Node:ActiveInterface:AvailableInterfaces:ConfiguredInterfaces:" + _mypnn=$(ctdb_pnn | sed -e 's@PNN:@@') + + if $machine_readable ; then + if $verbose ; then + echo "|Public IP|Node|ActiveInterface|AvailableInterfaces|ConfiguredInterfaces|" + else + echo "|Public IP|Node|" + fi else - echo ":Public IP:Node:" + echo "Public IPs on node ${_mypnn}" fi - _mypnn=$(ctdb_pnn | sed -e 's@PNN:@@') - # Join public addresses file with $FAKE_CTDB_IP_LAYOUT, and # process output line by line... _pa="${CTDB_PUBLIC_ADDRESSES:-${CTDB_BASE}/public_addresses}" @@ -167,9 +171,17 @@ ctdb_ip () if [ "$_pnn" = "$_mypnn" ]; then _my_iface="$_first_iface" fi - echo "|${_ip}|${_pnn}|${_my_iface}|${_first_iface}|${_ifaces}|" + if $machine_readable ; then + echo "|${_ip}|${_pnn}|${_my_iface}|${_first_iface}|${_ifaces}|" + else + echo "${_ip} node[${_pnn}] active[${_my_iface}] available[${_first_iface}] configured[[${_ifaces}]" + fi else - echo "|${_ip}|${_pnn}|" + if $machine_readable ; then + echo "|${_ip}|${_pnn}|" + else + echo "${_ip} ${_pnn}" + fi fi done } @@ -445,7 +457,7 @@ case "$1" in exit 0 ;; scriptstatus) - $machine_readable || not_implemented "$1, without -Y" + $machine_readable || not_implemented "$1, without -X" [ "$2" != "all" ] || not_implemented "scriptstatus all" # For now just assume everything is good. echo "|Type|Name|Code|Status|Start|End|Error Output...|" -- 2.11.4.GIT