Commit b16a43d5 authored by Rafael Monnerat's avatar Rafael Monnerat

slaprunner: Update all softwares from on slapos proxy

parent 41af80a5
......@@ -22,7 +22,7 @@ md5sum = 60b4d2025eace8da7de14b5bae3772d9
[template-runner-import-script]
filename = template/runner-import.sh.jinja2
md5sum = f2e2493bc5da90a53f86e5bcf64d2d57
md5sum = 3d4743b5ef16045611043b8f412381e6
[instance-runner-import]
filename = instance-runner-import.cfg.in
......
......@@ -181,7 +181,25 @@ EOF
)
db_query "update $DB_PARTITION_TABLE set software_release='$SOFTWARE_RELEASE' where software_release NOT NULL;"
db_query "update $DB_SOFTWARE_TABLE set url='$SOFTWARE_RELEASE' where url='$OLD_SOFTWARE_RELEASE';" || db_query "delete from $DB_SOFTWARE_TABLE where url='$OLD_SOFTWARE_RELEASE';"
SOFTWARE_RELEASE_LIST=$(db_query "select url from $DB_SOFTWARE_TABLE")
for SOFTWARE_RELEASE_TO_MIGRATE in $SOFTWARE_RELEASE_LIST; do
SOFTWARE_RELEASE_MIGRATED=$({{ sys.executable }} - $SOFTWARE_RELEASE_TO_MIGRATE $PARTITION <<EOF
if 1:
import os, re, sys
# We want to replace the last occurence only
old_software_release, partition = sys.argv[1], sys.argv[2]
for match in re.finditer("(slappart|test0-)[0-9][0-9]*", old_software_release):
start, end = match.start(), match.end()
print old_software_release[:start] + partition + old_software_release[end:]
EOF
)
db_query "update $DB_SOFTWARE_TABLE set url='$SOFTWARE_RELEASE_MIGRATED' where url='$SOFTWARE_RELEASE_TO_MIGRATE';" || db_query "delete from $DB_SOFTWARE_TABLE where url='$SOFTWARE_RELEASE_TO_MIGRATE';"
done
# Change slapproxy database to have all instances stopped
db_query "update $DB_PARTITION_TABLE set requested_state='stopped';"
# Change slapproxy database to get correct IPs
......
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