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

generate config_db.json when boot firsttime after os installing #159

Merged
merged 1 commit into from
May 7, 2020
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
7 changes: 6 additions & 1 deletion files/image_config/updategraph/updategraph
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ check_system_warm_boot
copy_list="minigraph.xml snmp.yml acl.json config_db.json frr"
if [ -f /tmp/pending_config_migration ]; then
copy_config_files_and_directories $copy_list
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
cp /usr/share/sonic/device/$PLATFORM/minigraph.xml /etc/sonic/minigraph.xml
sonic-cfggen -H -m /etc/sonic/minigraph.xml -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json
if [ x"${WARM_BOOT}" == x"true" ]; then
echo "Warm reboot detected..."
elif [ "$enabled" = "true" ]; then
Expand All @@ -74,7 +77,9 @@ if [ -f /tmp/pending_config_initialization ]; then
if [ "$enabled" != "true" ]; then
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
PRESET=(`head -n 1 /usr/share/sonic/device/$PLATFORM/default_sku`)
sonic-cfggen -H -k ${PRESET[0]} --preset ${PRESET[1]} > /etc/sonic/config_db.json
#sonic-cfggen -H -k ${PRESET[0]} --preset ${PRESET[1]} > /etc/sonic/config_db.json
cp /usr/share/sonic/device/$PLATFORM/minigraph.xml /etc/sonic/minigraph.xml
sonic-cfggen -H -m /etc/sonic/minigraph.xml -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json
redis-cli -n $CONFIG_DB_INDEX FLUSHDB
sonic-cfggen -j /etc/sonic/config_db.json --write-to-db
redis-cli -n $CONFIG_DB_INDEX SET "CONFIG_DB_INITIALIZED" "1"
Expand Down