Skip to content

Commit

Permalink
Use create_schema for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
dtantsur committed Dec 9, 2021
1 parent 4ce895d commit 2e47baa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
15 changes: 15 additions & 0 deletions scripts/ironic-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,18 @@ function wait_for_interface_or_ip() {
function render_j2_config () {
python3 -c 'import os; import sys; import jinja2; sys.stdout.write(jinja2.Template(sys.stdin.read()).render(env=os.environ))' < $1 > $2
}

function run_ironic_dbsync() {
if [[ "${IRONIC_USE_MARIADB:-true}" == "true" ]]; then
# It's possible for the dbsync to fail if mariadb is not up yet, so
# retry until success
until ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade; do
echo "WARNING: ironic-dbsync failed, retrying"
sleep 1
done
else
# SQLite does not support some statements. Fortunately, we can just create
# the schema in one go instead of going through an upgrade.
ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema
fi
}
7 changes: 1 addition & 6 deletions scripts/runironic
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ export IRONIC_EXPOSE_JSON_RPC=${IRONIC_EXPOSE_JSON_RPC:-false}
# Ramdisk logs
mkdir -p /shared/log/ironic/deploy

# It's possible for the dbsync to fail if mariadb is not up yet, so
# retry until success
until ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade; do
echo "WARNING: ironic-dbsync failed, retrying"
sleep 1
done
run_ironic_dbsync

if [[ "$IRONIC_TLS_SETUP" == "true" && "${RESTART_CONTAINER_CERTIFICATE_UPDATED}" == "true" ]]; then
inotifywait -m -e delete_self "${IRONIC_CERT_FILE}" | while read file event; do
Expand Down
7 changes: 1 addition & 6 deletions scripts/runironic-conductor
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ export IRONIC_DEPLOYMENT="Conductor"
# Ramdisk logs
mkdir -p /shared/log/ironic/deploy

# It's possible for the dbsync to fail if mariadb is not up yet, so
# retry until success
until ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade; do
echo "WARNING: ironic-dbsync failed, retrying"
sleep 1
done
run_ironic_dbsync

if [[ "$IRONIC_TLS_SETUP" == "true" && "${RESTART_CONTAINER_CERTIFICATE_UPDATED}" == "true" ]]; then
inotifywait -m -e delete_self "${IRONIC_CERT_FILE}" | while read file event; do
Expand Down

0 comments on commit 2e47baa

Please sign in to comment.