Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[updategraph] enhance update graph handling #3549

Merged
merged 1 commit into from
Oct 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions files/image_config/updategraph/updategraph
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,20 @@ if [ -f /tmp/pending_config_migration ]; then
copy_config_files_and_directories $copy_list
if [ x"${WARM_BOOT}" == x"true" ]; then
echo "Warm reboot detected..."
elif [ "$enabled" = "true" ]; then
elif [ -r /etc/sonic/config_db.json ]; then
echo "Use config_db.json from old system..."
sonic-cfggen -j /etc/sonic/config_db.json --write-to-db

if [[ -x /usr/bin/db_migrator.py ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting the use of double square brackets here but single brackets elsewhere. I think we need to decide on one to use moving forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. this file has fixed use of [] and [[ ]]. We need to unify the usage. I think [[ ]] is safer for some reason I don't remember now. But it could be just a myth :-)

# Migrate the DB to the latest schema version if needed
/usr/bin/db_migrator.py -o migrate
fi
elif [ -r /etc/sonic/minigraph.xml ]; then
echo "Use minigraph.xml from old system..."
reload_minigraph
sonic-cfggen -d --print-data > /etc/sonic/config_db.json
else
echo "Use config_db.json from old system..."
sonic-cfggen -j /etc/sonic/config_db.json --write-to-db
echo "Didn't found neither config_db.json nor minigraph.xml ..."
fi
rm -f /tmp/pending_config_migration
sed -i "/enabled=/d" /etc/sonic/updategraph.conf
Expand Down