From c31d51f822798c10689d26a5f28b3dbc203ee744 Mon Sep 17 00:00:00 2001 From: LALLAU Bertrand Date: Mon, 16 Sep 2024 16:36:19 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9BSQLite:=20fix=20Ironic=20container?= =?UTF-8?q?=20restarting=20issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In case of SQLite implementation Ironic container fails to restart. create_schema will be called only when required. fix #562 Signed-off-by: LALLAU Bertrand --- scripts/ironic-common.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/ironic-common.sh b/scripts/ironic-common.sh index 388d1ea17..d1f091708 100644 --- a/scripts/ironic-common.sh +++ b/scripts/ironic-common.sh @@ -87,8 +87,11 @@ run_ironic_dbsync() 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 + # the schema in one go if not already created, instead of going through an upgrade + DB_VERSION="$(ironic-dbsync --config-file /etc/ironic/ironic.conf version)" + if [[ "${DB_VERSION}" == "None" ]]; then + ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema + fi fi }