Run db_migrator for non first-time reboots (#16116) (#16520)

This commit is contained in:
mssonicbld 2023-09-12 18:40:30 +08:00 committed by GitHub
parent dbfa8f9660
commit b4ab3e01df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -248,9 +248,18 @@ function postStartAction()
# This flag will be set to "1" after DB migration/initialization is completed as part of config-setup # This flag will be set to "1" after DB migration/initialization is completed as part of config-setup
$SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "0" $SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "0"
else else
$SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "0"
# this is not a first time boot to a new image. Datbase container starts w/ old pre-existing config
if [[ -x /usr/local/bin/db_migrator.py ]]; then
# Migrate the DB to the latest schema version if needed
if [ -z "$DEV" ]; then
/usr/local/bin/db_migrator.py -o migrate
fi
fi
# set CONFIG_DB_INITIALIZED to indicate end of config load and migration # set CONFIG_DB_INITIALIZED to indicate end of config load and migration
$SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1" $SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
fi fi
# Add redis UDS to the redis group and give read/write access to the group # Add redis UDS to the redis group and give read/write access to the group
REDIS_SOCK="/var/run/redis${DEV}/redis.sock" REDIS_SOCK="/var/run/redis${DEV}/redis.sock"
else else