Fixup cut command, add debug

This commit is contained in:
James Page 2013-02-06 17:27:33 +00:00
parent 685b2fd245
commit f621b4354c
1 changed files with 5 additions and 2 deletions

View File

@ -424,13 +424,16 @@ peer_units() {
##########################################################################
oldest_peer() {
peers=$1
local l_unit_no=$(echo $JUJU_UNIT_NAME | cut -d 1 -f 2)
local l_unit_no=$(echo $JUJU_UNIT_NAME | cut -d / -f 2)
for peer in $peers; do
local r_unit_no=$(echo $peer | cut -d 1 -f 2)
echo "Comparing $JUJU_UNIT_NAME with peers: $peers"
local r_unit_no=$(echo $peer | cut -d / -f 2)
if (($r_unit_no<$l_unit_no)); then
echo "Not oldest peer; deferring"
return 1
fi
done
echo "Oldest peer; might take charge?"
return 0
}