Commit 897ca020 authored by Hardik Juneja's avatar Hardik Juneja

Slaprunner: Runner Import (sqlite3) change to WAL mode to avoid database locked error

parent 20c21929
...@@ -31,7 +31,7 @@ md5sum = 5cfa49bcf20612844e1c50a85740d0b3 ...@@ -31,7 +31,7 @@ md5sum = 5cfa49bcf20612844e1c50a85740d0b3
[template-runner-export-script] [template-runner-export-script]
filename = template/runner-export.sh.jinja2 filename = template/runner-export.sh.jinja2
md5sum = 94c0eddb2af3290942f64e04f95a707c md5sum = 827c1b58b8b740820030b4bc96b8ec16
[instance-runner-export] [instance-runner-export]
filename = instance-runner-export.cfg.in filename = instance-runner-export.cfg.in
......
...@@ -135,6 +135,8 @@ DATABASE="$HOME/srv/runner/proxy.db" ...@@ -135,6 +135,8 @@ DATABASE="$HOME/srv/runner/proxy.db"
# Change slapproxy database to point instances to new software release # Change slapproxy database to point instances to new software release
# XXX hardcoded # XXX hardcoded
PARTITION=$(basename $HOME) PARTITION=$(basename $HOME)
# Change to WAL mode to avoide locks
"$SQLITE3" "$DATABASE" "PRAGMA journal_mode=WAL;"
OLD_SOFTWARE_RELEASE=$("$SQLITE3" "$DATABASE" "select software_release from partition11 where reference='slappart0';") 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 -e 's/\(.*\)\(slappart\|test0-\)[0-9][0-9][0-9]\?/\1'"$PARTITION"'/')
"$SQLITE3" "$DATABASE" "update partition11 set software_release='$SOFTWARE_RELEASE' where software_release NOT NULL;" "$SQLITE3" "$DATABASE" "update partition11 set software_release='$SOFTWARE_RELEASE' where software_release NOT NULL;"
...@@ -146,6 +148,7 @@ IPV4='{{ ipv4 }}' ...@@ -146,6 +148,7 @@ IPV4='{{ ipv4 }}'
IPV6='{{ ipv6 }}' IPV6='{{ ipv6 }}'
"$SQLITE3" "$DATABASE" "update partition_network11 set address='$IPV4' where netmask='255.255.255.255';" "$SQLITE3" "$DATABASE" "update partition_network11 set address='$IPV4' where netmask='255.255.255.255';"
"$SQLITE3" "$DATABASE" "update partition_network11 set address='$IPV6' where netmask='ffff:ffff:ffff::';" "$SQLITE3" "$DATABASE" "update partition_network11 set address='$IPV6' where netmask='ffff:ffff:ffff::';"
"$SQLITE3" "PRAGMA journal_mode=DELETE;"
MASTERURL='http://{{ ipv4 }}:{{ proxy_port }}' MASTERURL='http://{{ ipv4 }}:{{ proxy_port }}'
......
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