Merge "Fix upgrade logic to allow for bundled changes"
This commit is contained in:
commit
5d79347f97
@ -81,7 +81,12 @@ if [ $ret_val -gt 1 ] ; then
|
|||||||
# Warnings are permissible and returned as status code 1, errors are
|
# Warnings are permissible and returned as status code 1, errors are
|
||||||
# returned as greater than 1 which means there is a major upgrade
|
# returned as greater than 1 which means there is a major upgrade
|
||||||
# stopping issue which needs to be addressed.
|
# stopping issue which needs to be addressed.
|
||||||
die $LINENO "Ironic DB Status check failed, returned: $ret_val"
|
echo "WARNING: Status check failed, we're going to attempt to apply the schema update and then re-evaluate."
|
||||||
|
$IRONIC_BIN_DIR/ironic-dbsync --config-file=$IRONIC_CONF_FILE upgrade
|
||||||
|
$IRONIC_BIN_DIR/ironic-status upgrade check && ret_val=$? || ret_val=$?
|
||||||
|
if [ $ret_val -gt 1 ] ; then
|
||||||
|
die $LINENO "Ironic DB Status check failed, returned: $ret_val"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$IRONIC_BIN_DIR/ironic-dbsync --config-file=$IRONIC_CONF_FILE
|
$IRONIC_BIN_DIR/ironic-dbsync --config-file=$IRONIC_CONF_FILE
|
||||||
|
@ -19,6 +19,7 @@ from oslo_db.sqlalchemy import enginefacade
|
|||||||
from oslo_db.sqlalchemy import utils
|
from oslo_db.sqlalchemy import utils
|
||||||
from oslo_upgradecheck import common_checks
|
from oslo_upgradecheck import common_checks
|
||||||
from oslo_upgradecheck import upgradecheck
|
from oslo_upgradecheck import upgradecheck
|
||||||
|
from sqlalchemy import exc as sa_exc
|
||||||
|
|
||||||
from ironic.cmd import dbsync
|
from ironic.cmd import dbsync
|
||||||
from ironic.common.i18n import _
|
from ironic.common.i18n import _
|
||||||
@ -44,7 +45,15 @@ class Checks(upgradecheck.UpgradeCommands):
|
|||||||
.version field in the database, with the expected versions
|
.version field in the database, with the expected versions
|
||||||
of these objects.
|
of these objects.
|
||||||
"""
|
"""
|
||||||
msg = dbsync.DBCommand().check_obj_versions(ignore_missing_tables=True)
|
try:
|
||||||
|
# NOTE(TheJulia): Seems an exception is raised by sqlalchemy
|
||||||
|
# when a table is missing, so lets catch it, since it is fatal.
|
||||||
|
msg = dbsync.DBCommand().check_obj_versions(
|
||||||
|
ignore_missing_tables=True)
|
||||||
|
except sa_exc.NoSuchTableError as e:
|
||||||
|
msg = ('Database table missing. Please ensure you have '
|
||||||
|
'updated the database schema. Not Found: %s' % e)
|
||||||
|
return upgradecheck.Result(upgradecheck.Code.FAILURE, details=msg)
|
||||||
|
|
||||||
if not msg:
|
if not msg:
|
||||||
return upgradecheck.Result(upgradecheck.Code.SUCCESS)
|
return upgradecheck.Result(upgradecheck.Code.SUCCESS)
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Handles excessively long errors when the status upgrade check is executed,
|
||||||
|
and simply indicates now if a table is missing, suggesting to update the
|
||||||
|
database schema before proceeding.
|
Loading…
x
Reference in New Issue
Block a user