[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Fri Sep 16 04:36:01 UTC 2022


The branch, master has been updated
       via  4f5b4bd9dfb ctdb-tests: Reformat remaining test stubs with "shfmt -w -p -i 0 -fn"
       via  0e388a1994e ctdb-tests: Include eventscript stub commands in shellcheck test
       via  4ee0abaece9 ctdb-tests: Avoid shellcheck warnings in remaining test stubs
       via  a31fb7e5ab8 ctdb-scripts: Simplify determination of real interface
       via  5abaec49927 ctdb-tests: Implement "ip -brief link show" in ip stub
       via  ef921bdbdba ctdb-tests: Avoid ShellCheck warnings
       via  67e0ca5e014 ctdb-tests: Reformat script with "shfmt -w -p -i 0 -fn"
       via  517f09eb6f3 ctdb-scripts: Drop assumption that there are VLANs with no '@'
      from  cc64ea24daa CVE-2020-25720 s4:dsdb/descriptor: explain lack of dSHeuristics check

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4f5b4bd9dfb7690359dbae6b687f97946761dd22
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Aug 26 09:16:49 2022 +1000

    ctdb-tests: Reformat remaining test stubs with "shfmt -w -p -i 0 -fn"
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Fri Sep 16 04:35:09 UTC 2022 on sn-devel-184

commit 0e388a1994e0f6715466eba1d3bdd765c36f956f
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Aug 18 09:36:08 2022 +1000

    ctdb-tests: Include eventscript stub commands in shellcheck test
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 4ee0abaece92efd28901801c020cfdf5b80fcadb
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Aug 18 08:59:28 2022 +1000

    ctdb-tests: Avoid shellcheck warnings in remaining test stubs
    
    A small amount of effort...
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit a31fb7e5ab8439349bc2670b3fde1020ba2c48b5
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Aug 17 11:38:44 2022 +1000

    ctdb-scripts: Simplify determination of real interface
    
    This can now be made trivial.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 5abaec499275bc47fb596e6bf2fa9fe98a891e79
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Aug 17 11:37:56 2022 +1000

    ctdb-tests: Implement "ip -brief link show" in ip stub
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit ef921bdbdbacecf39ee2a1851f16dbba62175fcc
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Aug 17 12:12:30 2022 +1000

    ctdb-tests: Avoid ShellCheck warnings
    
    Although this is a test stub, it is complicated enough to encourage
    ShellCheck cleanliness.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 67e0ca5e01439b9efe4611c5fcfd0bf2ac69423b
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Aug 17 11:41:33 2022 +1000

    ctdb-tests: Reformat script with "shfmt -w -p -i 0 -fn"
    
    As per current Samba convention.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 517f09eb6f325af0d69b14d5b6b0e6b84616c6ce
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Aug 17 11:04:10 2022 +1000

    ctdb-scripts: Drop assumption that there are VLANs with no '@'
    
    VLAN configuration on Linux often uses a convention of naming a VLAN
    on <iface> with VLAN ID <tag> as <iface>.<tag>.  To be able to monitor
    the underlying interface, the original 10.interface code naively
    simply stripped off the '.' and everything after (i.e. ".*", as a glob
    pattern).
    
    Some users do not use the above convention.  A VLAN can be named
    without including the underlying interface, but still with a
    tag (e.g. vlan<tag> - the word "vlan" following by the tag) or, more
    generally, perhaps without a tag (e.g. <vlan> - an arbitrary name).
    The ip(8) command lists a VLAN as <vlan>@<iface>.  The underlying
    interface can be found by stripping everything up to and including an
    '@' (i.e. "*@").
    
    Commit bc71251433ce618c95c674d7cbe75b01a94adad9 added support for
    stripping "*@".  However, on suspicion, it kept support for the case
    where there is no '@', falling back to stripping ".*".  If ip(8) ever
    did this then it was a long time ago - it has been printing a format
    including '@' since at least 2004.
    
    Stripping ".*" interferes with interesting administrative decisions,
    like having '.' in interface names.
    
    So, drop the fallback to stripping ".*" because it appears to be
    unnecessary and can cause inconvenience.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/config/functions                              |   29 +-
 ctdb/tests/UNIT/eventscripts/stubs/ctdb            |  498 ++++----
 ctdb/tests/UNIT/eventscripts/stubs/ctdb_killtcp    |    5 +-
 ctdb/tests/UNIT/eventscripts/stubs/ctdb_lvs        |   33 +-
 ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw      |   38 +-
 ctdb/tests/UNIT/eventscripts/stubs/date            |    8 +-
 ctdb/tests/UNIT/eventscripts/stubs/df              |   26 +-
 ctdb/tests/UNIT/eventscripts/stubs/ethtool         |    4 +-
 ctdb/tests/UNIT/eventscripts/stubs/exportfs        |   16 +-
 ctdb/tests/UNIT/eventscripts/stubs/gstack          |    6 +-
 ctdb/tests/UNIT/eventscripts/stubs/ip              | 1208 +++++++++++---------
 ctdb/tests/UNIT/eventscripts/stubs/ipvsadm         |   92 +-
 ctdb/tests/UNIT/eventscripts/stubs/multipath       |   24 +-
 ctdb/tests/UNIT/eventscripts/stubs/pidof           |    5 +-
 ctdb/tests/UNIT/eventscripts/stubs/ps              |   14 +-
 ctdb/tests/UNIT/eventscripts/stubs/rm              |    4 +-
 ctdb/tests/UNIT/eventscripts/stubs/rpcinfo         |   73 +-
 ctdb/tests/UNIT/eventscripts/stubs/service         |   55 +-
 ctdb/tests/UNIT/eventscripts/stubs/sleep           |   10 +-
 ctdb/tests/UNIT/eventscripts/stubs/smnotify        |   49 +-
 ctdb/tests/UNIT/eventscripts/stubs/ss              |  115 +-
 ctdb/tests/UNIT/eventscripts/stubs/stat            |   20 +-
 ctdb/tests/UNIT/eventscripts/stubs/tdb_mutex_check |    8 +-
 ctdb/tests/UNIT/eventscripts/stubs/tdbdump         |   10 +-
 ctdb/tests/UNIT/eventscripts/stubs/tdbtool         |   39 +-
 ctdb/tests/UNIT/eventscripts/stubs/testparm        |   74 +-
 ctdb/tests/UNIT/eventscripts/stubs/timeout         |    8 +-
 ctdb/tests/UNIT/eventscripts/stubs/wbinfo          |    4 +-
 ctdb/tests/UNIT/shellcheck/tests.sh                |    4 +
 29 files changed, 1358 insertions(+), 1121 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/functions b/ctdb/config/functions
index 82ed0957aa0..dcb04ebb5ef 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -631,26 +631,11 @@ flush_route_cache ()
 # underlying interface
 interface_get_real ()
 {
-    # Output of "ip link show <iface>"
-    _iface_info="$1"
-
-    # Extract the full interface description to see if it is a VLAN
-    _t=$(echo "$_iface_info" |
-		awk 'NR == 1 { iface = $2; sub(":$", "", iface) ;
-			       print iface }')
-    case "$_t" in
-	*@*)
-	    # VLAN: use the underlying interface, after the '@'
-	    echo "${_t##*@}"
-	    ;;
-	*)
-	    # Not a regular VLAN.  For backward compatibility, assume
-	    # there is some other sort of VLAN that doesn't have the
-	    # '@' in the output and only use what is before a '.'.  If
-	    # there is no '.' then this will be the whole interface
-	    # name.
-	    echo "${_t%%.*}"
-    esac
+	_iface="$1"
+
+	# If $_iface is a VLAN (i.e. contains an '@') then strip every
+	# before the '@', otherwise print the whole interface
+	echo "${_iface##*@}"
 }
 
 # Check whether an interface is operational
@@ -658,7 +643,7 @@ interface_monitor ()
 {
     _iface="$1"
 
-    _iface_info=$(ip link show "$_iface" 2>&1) || {
+    _iface_info=$(ip -br link show "$_iface" 2>&1) || {
 	echo "ERROR: Monitored interface ${_iface} does not exist"
 	return 1
     }
@@ -666,7 +651,7 @@ interface_monitor ()
 
     # If the interface is a virtual one (e.g. VLAN) then get the
     # underlying interface.
-    _realiface=$(interface_get_real "$_iface_info")
+    _realiface=$(interface_get_real "${_iface_info%% *}")
 
     if _bi=$(get_proc "net/bonding/${_realiface}" 2>/dev/null) ; then
 	# This is a bond: various monitoring strategies
diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ctdb b/ctdb/tests/UNIT/eventscripts/stubs/ctdb
index fc7bd4fdd84..4d8f3b68ef1 100755
--- a/ctdb/tests/UNIT/eventscripts/stubs/ctdb
+++ b/ctdb/tests/UNIT/eventscripts/stubs/ctdb
@@ -3,28 +3,29 @@
 prog="ctdb"
 
 # Print a message and exit.
-die ()
+die()
 {
-    echo "$1" >&2 ; exit ${2:-1}
+	echo "$1" >&2
+	exit "${2:-1}"
 }
 
 not_implemented_exit_code=1
 
-usage ()
+usage()
 {
-    cat >&2 <<EOF
+	cat >&2 <<EOF
 Usage: $prog [-X] cmd
 
 A fake CTDB stub that prints items depending on the variables
 FAKE_CTDB_PNN (default 0) depending on command-line options.
 EOF
-    exit 1
+	exit 1
 }
 
-not_implemented ()
+not_implemented()
 {
-    echo "${prog}: command \"$1\" not implemented in stub" >&2
-    exit $not_implemented_exit_code
+	echo "${prog}: command \"$1\" not implemented in stub" >&2
+	exit $not_implemented_exit_code
 }
 
 verbose=false
@@ -36,106 +37,108 @@ args=""
 # Options and command argument can appear in any order, so when
 # getopts thinks it is done, process any non-option arguments and go
 # around again.
-while [ $# -gt 0 ] ; do
-	while getopts "Xvhn:?" opt ; do
+while [ $# -gt 0 ]; do
+	while getopts "Xvhn:?" opt; do
 		case "$opt" in
 		X) machine_readable=true ;;
 		v) verbose=true ;;
 		n) nodespec="$OPTARG" ;;
-		\?|*) usage ;;
+		\? | *) usage ;;
 		esac
 	done
 	shift $((OPTIND - 1))
 
 	# Anything left over must be a non-option arg
-	if [ $# -gt 0 ] ; then
+	if [ $# -gt 0 ]; then
 		args="${args}${args:+ }${1}"
 		shift
 	fi
 done
 
 [ -n "$args" ] || usage
+# Want word splitting
+# shellcheck disable=SC2086
 set -- $args
 
-setup_tickles ()
+setup_tickles()
 {
-    # Make sure tickles file exists.
-    tickles_file="${CTDB_TEST_TMP_DIR}/fake-ctdb/tickles"
-    mkdir -p $(dirname "$tickles_file")
-    touch "$tickles_file"
+	# Make sure tickles file exists.
+	tickles_file="${CTDB_TEST_TMP_DIR}/fake-ctdb/tickles"
+	mkdir -p "$(dirname "$tickles_file")"
+	touch "$tickles_file"
 }
 
-ctdb_gettickles ()
+ctdb_gettickles()
 {
-    _ip="$1"
-    _port="$2"
+	_ip="$1"
+	_port="$2"
 
-    setup_tickles
+	setup_tickles
 
-    echo "|source ip|port|destination ip|port|"
-    while read _src _dst ; do
-	if [ -z "$_ip" -o "$_ip" = "${_dst%:*}" ] ; then
-	    if [ -z "$_port" -o "$_port" = "${_dst##*:}" ] ; then
-		echo "|${_src%:*}|${_src##*:}|${_dst%:*}|${_dst##*:}|"
-	    fi
-	fi
-    done <"$tickles_file"
+	echo "|source ip|port|destination ip|port|"
+	while read -r _src _dst; do
+		if [ -z "$_ip" ] || [ "$_ip" = "${_dst%:*}" ]; then
+			if [ -z "$_port" ] || [ "$_port" = "${_dst##*:}" ]; then
+				echo "|${_src%:*}|${_src##*:}|${_dst%:*}|${_dst##*:}|"
+			fi
+		fi
+	done <"$tickles_file"
 }
 
-ctdb_addtickle ()
+ctdb_addtickle()
 {
-    _src="$1"
-    _dst="$2"
+	_src="$1"
+	_dst="$2"
 
-    setup_tickles
+	setup_tickles
 
-    if [ -n "$_dst" ] ; then
-	echo "${_src} ${_dst}" >>"$tickles_file"
-    else
-	cat >>"$tickles_file"
-    fi
+	if [ -n "$_dst" ]; then
+		echo "${_src} ${_dst}" >>"$tickles_file"
+	else
+		cat >>"$tickles_file"
+	fi
 }
 
-ctdb_deltickle ()
+ctdb_deltickle()
 {
-    _src="$1"
-    _dst="$2"
+	_src="$1"
+	_dst="$2"
 
-    setup_tickles
+	setup_tickles
 
-    if [ -n "$_dst" ] ; then
-	_t=$(grep -F -v "${_src} $${_dst}" "$tickles_file")
-    else
-	_t=$(cat "$tickles_file")
-	while read _src _dst ; do
-	    _t=$(echo "$_t" | grep -F -v "${_src} ${_dst}")
-	done
-    fi
-    echo "$_t" >"$tickles_file"
+	if [ -n "$_dst" ]; then
+		_t=$(grep -F -v "${_src} $${_dst}" "$tickles_file")
+	else
+		_t=$(cat "$tickles_file")
+		while read -r _src _dst; do
+			_t=$(echo "$_t" | grep -F -v "${_src} ${_dst}")
+		done
+	fi
+	echo "$_t" >"$tickles_file"
 }
 
-parse_nodespec ()
+parse_nodespec()
 {
-    if [ "$nodespec" = "all" ] ; then
-	nodes="$(seq 0 $((FAKE_CTDB_NUMNODES - 1)) )"
-    elif [ -n "$nodespec" ] ; then
-	nodes="$(echo $nodespec | sed -e 's@,@ @g')"
-    else
-	node=$(ctdb_pnn)
-    fi
+	if [ "$nodespec" = "all" ]; then
+		nodes="$(seq 0 $((FAKE_CTDB_NUMNODES - 1)))"
+	elif [ -n "$nodespec" ]; then
+		nodes="$(echo "$nodespec" | sed -e 's@,@ @g')"
+	else
+		nodes=$(ctdb_pnn)
+	fi
 }
 
 # For testing backward compatibility...
-for i in $CTDB_NOT_IMPLEMENTED ; do
-    if [ "$i" = "$1" ] ; then
-	not_implemented "$i"
-    fi
+for i in $CTDB_NOT_IMPLEMENTED; do
+	if [ "$i" = "$1" ]; then
+		not_implemented "$i"
+	fi
 done
 
-ctdb_pnn ()
+ctdb_pnn()
 {
-    # Defaults to 0
-    echo "${FAKE_CTDB_PNN:-0}"
+	# Defaults to 0
+	echo "${FAKE_CTDB_PNN:-0}"
 }
 
 ######################################################################
@@ -149,143 +152,147 @@ FAKE_CTDB_NODES_DISABLED="$FAKE_CTDB_NODE_STATE/0x4"
 
 FAKE_CTDB_IP_LAYOUT="$FAKE_CTDB_STATE/ip-layout"
 
-ip_reallocate ()
+ip_reallocate()
 {
-    touch "$FAKE_CTDB_IP_LAYOUT"
+	touch "$FAKE_CTDB_IP_LAYOUT"
 
-    (
-	flock 0
+	# ShellCheck doesn't understand this flock pattern
+	# shellcheck disable=SC2094
+	(
+		flock 0
 
-	_pa="${CTDB_BASE}/public_addresses"
+		_pa="${CTDB_BASE}/public_addresses"
 
-	if [ ! -s "$FAKE_CTDB_IP_LAYOUT" ] ; then
-	    sed -n -e 's@^\([^#][^/]*\)/.*@\1 -1 at p' \
-		"$_pa" >"$FAKE_CTDB_IP_LAYOUT"
-	fi
+		if [ ! -s "$FAKE_CTDB_IP_LAYOUT" ]; then
+			sed -n -e 's@^\([^#][^/]*\)/.*@\1 -1 at p' \
+				"$_pa" >"$FAKE_CTDB_IP_LAYOUT"
+		fi
 
-	_t="${FAKE_CTDB_IP_LAYOUT}.new"
-
-	_flags=""
-	for _i in $(seq 0 $((FAKE_CTDB_NUMNODES - 1)) ) ; do
-	    if ls "$FAKE_CTDB_STATE/node-state/"*"/$_i" >/dev/null 2>&1 ; then
-		# Have non-zero flags
-		_this=0
-		for _j in "$FAKE_CTDB_STATE/node-state/"*"/$_i" ; do
-		    _tf="${_j%/*}" # dirname
-		    _f="${_tf##*/}" # basename
-		    _this=$(( $_this | $_f ))
+		_t="${FAKE_CTDB_IP_LAYOUT}.new"
+
+		_flags=""
+		for _i in $(seq 0 $((FAKE_CTDB_NUMNODES - 1))); do
+			if ls "$FAKE_CTDB_STATE/node-state/"*"/$_i" >/dev/null 2>&1; then
+				# Have non-zero flags
+				_this=0
+				for _j in "$FAKE_CTDB_STATE/node-state/"*"/$_i"; do
+					_tf="${_j%/*}"  # dirname
+					_f="${_tf##*/}" # basename
+					_this=$((_this | _f))
+				done
+			else
+				_this="0"
+			fi
+			_flags="${_flags}${_flags:+,}${_this}"
 		done
-	    else
-		_this="0"
-	    fi
-	    _flags="${_flags}${_flags:+,}${_this}"
-	done
-	CTDB_TEST_LOGLEVEL=NOTICE \
-	    "ctdb_takeover_tests" \
-	    "ipalloc" "$_flags" <"$FAKE_CTDB_IP_LAYOUT" |
-	    sort >"$_t"
-	mv "$_t" "$FAKE_CTDB_IP_LAYOUT"
-    ) <"$FAKE_CTDB_IP_LAYOUT"
+		CTDB_TEST_LOGLEVEL=NOTICE \
+			"ctdb_takeover_tests" \
+			"ipalloc" "$_flags" <"$FAKE_CTDB_IP_LAYOUT" |
+			sort >"$_t"
+		mv "$_t" "$FAKE_CTDB_IP_LAYOUT"
+	) <"$FAKE_CTDB_IP_LAYOUT"
 }
 
-ctdb_ip ()
+ctdb_ip()
 {
-    # If nobody has done any IP-fu then generate a layout.
-    [ -f "$FAKE_CTDB_IP_LAYOUT" ] || ip_reallocate
+	# If nobody has done any IP-fu then generate a layout.
+	[ -f "$FAKE_CTDB_IP_LAYOUT" ] || ip_reallocate
 
-    _mypnn=$(ctdb_pnn)
+	_mypnn=$(ctdb_pnn)
 
-    if $machine_readable ; then
-	if $verbose ; then
-	    echo "|Public IP|Node|ActiveInterface|AvailableInterfaces|ConfiguredInterfaces|"
-	else
-	    echo "|Public IP|Node|"
-	fi
-    else
-	echo "Public IPs on node ${_mypnn}"
-    fi
-
-    # Join public addresses file with $FAKE_CTDB_IP_LAYOUT, and
-    # process output line by line...
-    _pa="${CTDB_BASE}/public_addresses"
-    sed -e 's@/@ @' "$_pa" | sort | join - "$FAKE_CTDB_IP_LAYOUT" |
-    while read _ip _bit _ifaces _pnn ; do
-	if $verbose ; then
-	    # If more than 1 interface, assume all addresses are on the 1st.
-	    _first_iface="${_ifaces%%,*}"
-	    # Only show interface if address is on this node.
-	    _my_iface=""
-	    if [ "$_pnn" = "$_mypnn" ]; then
-		_my_iface="$_first_iface"
-	    fi
-	    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
+	if $machine_readable; then
+		if $verbose; then
+			echo "|Public IP|Node|ActiveInterface|AvailableInterfaces|ConfiguredInterfaces|"
+		else
+			echo "|Public IP|Node|"
+		fi
 	else
-	    if $machine_readable ; then
-		echo "|${_ip}|${_pnn}|"
-	    else
-		echo "${_ip} ${_pnn}"
-	    fi
+		echo "Public IPs on node ${_mypnn}"
 	fi
-    done
+
+	# Join public addresses file with $FAKE_CTDB_IP_LAYOUT, and
+	# process output line by line...
+	_pa="${CTDB_BASE}/public_addresses"
+	sed -e 's@/@ @' "$_pa" | sort | join - "$FAKE_CTDB_IP_LAYOUT" |
+		while read -r _ip _ _ifaces _pnn; do
+			if $verbose; then
+				# If more than 1 interface, assume all addresses are on the 1st.
+				_first_iface="${_ifaces%%,*}"
+				# Only show interface if address is on this node.
+				_my_iface=""
+				if [ "$_pnn" = "$_mypnn" ]; then
+					_my_iface="$_first_iface"
+				fi
+				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
+				if $machine_readable; then
+					echo "|${_ip}|${_pnn}|"
+				else
+					echo "${_ip} ${_pnn}"
+				fi
+			fi
+		done
 }
 
-ctdb_moveip ()
+ctdb_moveip()
 {
-    _ip="$1"
-    _target="$2"
+	_ip="$1"
+	_target="$2"
 
-    ip_reallocate  # should be harmless and ensures we have good state
+	ip_reallocate # should be harmless and ensures we have good state
 
-    (
-	flock 0
+	# ShellCheck doesn't understand this flock pattern
+	# shellcheck disable=SC2094
+	(
+		flock 0
 
-	_t="${FAKE_CTDB_IP_LAYOUT}.new"
+		_t="${FAKE_CTDB_IP_LAYOUT}.new"
 
-	while read _i _pnn ; do
-	    if [ "$_ip" = "$_i" ] ; then
-		echo "$_i $_target"
-	    else
-		echo "$_i $_pnn"
-	    fi
-	done | sort >"$_t"
-	mv "$_t" "$FAKE_CTDB_IP_LAYOUT"
-    ) <"$FAKE_CTDB_IP_LAYOUT"
+		while read -r _i _pnn; do
+			if [ "$_ip" = "$_i" ]; then
+				echo "$_i $_target"
+			else
+				echo "$_i $_pnn"
+			fi
+		done | sort >"$_t"
+		mv "$_t" "$FAKE_CTDB_IP_LAYOUT"
+	) <"$FAKE_CTDB_IP_LAYOUT"
 }
 
 ######################################################################
 
-ctdb_enable ()
+ctdb_enable()
 {
-    parse_nodespec
-    
-    for _i in $nodes ; do
-	rm -f "${FAKE_CTDB_NODES_DISABLED}/${_i}"
-    done
+	parse_nodespec
 
-    ip_reallocate
+	for _i in $nodes; do
+		rm -f "${FAKE_CTDB_NODES_DISABLED}/${_i}"
+	done
+
+	ip_reallocate
 }
 
-ctdb_disable ()
+ctdb_disable()
 {
-    parse_nodespec
+	parse_nodespec
 
-    for _i in $nodes ; do
-	mkdir -p "$FAKE_CTDB_NODES_DISABLED"
-	touch "${FAKE_CTDB_NODES_DISABLED}/${_i}"
-    done
+	for _i in $nodes; do
+		mkdir -p "$FAKE_CTDB_NODES_DISABLED"
+		touch "${FAKE_CTDB_NODES_DISABLED}/${_i}"
+	done
 
-    ip_reallocate
+	ip_reallocate


-- 
Samba Shared Repository



More information about the samba-cvs mailing list