Just print the PNN.
Update dependent code.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
{
_pnn_file="${CTDB_SCRIPT_VARDIR}/my-pnn"
if [ ! -f "$_pnn_file" ] ; then
- $CTDB pnn | sed -e 's@.*:@@' >"$_pnn_file"
+ $CTDB pnn >"$_pnn_file"
fi
cat "$_pnn_file"
elif [ -n "$nodespec" ] ; then
nodes="$(echo $nodespec | sed -e 's@,@ @g')"
else
- _t=$(ctdb_pnn)
- nodes="${_t#PNN:}"
+ node=$(ctdb_pnn)
fi
}
ctdb_pnn ()
{
# Defaults to 0
- echo "PNN:${FAKE_CTDB_PNN:-0}"
+ echo "${FAKE_CTDB_PNN:-0}"
}
######################################################################
# If nobody has done any IP-fu then generate a layout.
[ -f "$FAKE_CTDB_IP_LAYOUT" ] || ip_reallocate
- _mypnn=$(ctdb_pnn | sed -e 's@PNN:@@')
+ _mypnn=$(ctdb_pnn)
if $machine_readable ; then
if $verbose ; then
ctdb_get_all_pnns ()
{
- try_command_on_node -q all "$CTDB pnn | sed -e 's@PNN:@@'"
+ try_command_on_node -q all "$CTDB pnn"
all_pnns="$out"
}
mypnn = getpnn(ctdb);
- printf("PNN:%d\n", mypnn);
+ printf("%u\n", mypnn);
return 0;
}
# We do a recursive onnode to find which nodes are up and running.
local out line
out=$("$0" -pq all ctdb pnn 2>&1)
- while read line ; do
- local pnn="${line#PNN:}"
- if [ "$pnn" != "$line" ] ; then
+ while read line ; do
+ if [[ "$line" =~ ^[0-9]+$ ]] ; then
+ local pnn="$line"
# Intentional multi-word expansion
# shellcheck disable=SC2086
echo_nth "$pnn" $all_nodes