Commit b8be3950 authored by Tristan Cavelier's avatar Tristan Cavelier

fixup! slaprunner: Support resilience on computers with more them 100 partitions

The regexp was matching "slappart10" in `/path/to/slappart10/software.cfg`,
was also matching "slappart10" in `/path/to/aaslappart10aa/software.cfg`
and was not matching "slappart1" in `/path/to/slappart1/software.cfg`
or "slappart1000" in `/path/to/slappart1000/software.cfg`.

The fix allows to match "slappartX" in `/path/to/slappartX/software.cfg`
where X can be between 0 to infinite. Also, it protects from matching
"slappartX" in `/path/to/aaaslappartXaaa/software.cfg`.
parent e419ece6
......@@ -136,7 +136,7 @@ DATABASE="$HOME/srv/runner/proxy.db"
# XXX hardcoded
PARTITION=$(basename $HOME)
OLD_SOFTWARE_RELEASE=$("$SQLITE3" "$DATABASE" "select software_release from partition11 where reference='slappart0';")
SOFTWARE_RELEASE=$(echo $OLD_SOFTWARE_RELEASE | sed -e 's/\(.*\)\(slappart\|test0-\)[0-9][0-9][0-9]\?/\1'"$PARTITION"'/')
SOFTWARE_RELEASE=$(echo "$OLD_SOFTWARE_RELEASE" | sed 's/\/\(slappart\|test0-\)[0-9][0-9]*\//\/'"$PARTITION"'\//')
"$SQLITE3" "$DATABASE" "update partition11 set software_release='$SOFTWARE_RELEASE' where software_release NOT NULL;"
"$SQLITE3" "$DATABASE" "update software11 set url='$SOFTWARE_RELEASE' where url='$OLD_SOFTWARE_RELEASE';" || "$SQLITE3" "$DATABASE" "delete from software11 where url='$OLD_SOFTWARE_RELEASE';"
# Change slapproxy database to have all instances stopped
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment