onnode: Be defensive when listing IPs of nodes with designated status.
authorMartin Schwenke <martin@meltin.net>
Tue, 17 May 2011 03:20:51 +0000 (13:20 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 8 Jun 2011 04:21:48 +0000 (14:21 +1000)
The current version gives the last item left after stripping the known
fields.  If an insufficent number of status fields is stripped then
this would return a residual status field value, which turned out to
be a valid IP address for localhost...  so no error occurs.

This change means that the node number is stripped and any residual
status field value will stay appended, causing an error the first time
this command is tested.

Signed-off-by: Martin Schwenke <martin@meltin.net>
tools/onnode

index 264937ea6841a6b357b95c8af1c48c56adeb1481..7e1b0cac835588dcb8a37d153dae777e984344b7 100755 (executable)
@@ -169,7 +169,7 @@ get_nodes_with_status ()
            # the nth node to get the address.  This would make things
            # more consistent if $ctdb_base/nodes actually contained
            # hostnames.
-           nodes="${nodes} ${t##*:}"
+           nodes="${nodes} ${t#:*:}"
        fi
     done