slaprunner: Support resilience on computers with more them 100 partitions
This block could be generalized a bit more but it will be unlikely to have computers with more them 1000 partitions.
Showing
-
Owner
I think this breaks for the first 10 partitions, where you have a single digit. I'd rather write:
SOFTWARE_RELEASE=$(echo $OLD_SOFTWARE_RELEASE | sed -e 's/\(.*\)\(slappart\|test0-\)[0-9]\+/\1'"$PARTITION"'/')
And now, it also works for more than 1000 partitions.
Slighly more reliable:
SOFTWARE_RELEASE=$(echo $OLD_SOFTWARE_RELEASE | sed -e 's,\(.*/\)\(slappart\|test0-\)[0-9]\+/,\1'"$PARTITION"/,)
By using
sed -r
, we could get rid of all those\
but I don't know about portability. -
Owner
In case it does not appear clearly, the idea of my second suggestion is to make sure that
slappart123
is immediately preceded and followed by a/
. And when maching/
chars, it's easier to use a different sed separator ... that must not appear inPARTITION
.
Please register or sign in to comment