[vstes] Virtual chssis default config rendering (#8008)

Fixed issue introduced by PR#7857. The problem was that introduction of
using init_cfg.json.j2 template did not have instruction in
init_config.json.j2 to merge the virtual chassis default_config.json.
Ths fix is to have a separate invokiation of sonic-cfggen to combine
init_config.json and virtual chassis default_config.json

Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
This commit is contained in:
vganesan-nokia 2021-10-26 21:19:58 -04:00 committed by GitHub
parent b91190d82d
commit 7e34a54b30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,17 +27,18 @@ popd
[ -d /etc/sonic ] || mkdir -p /etc/sonic
if [[ -f /usr/share/sonic/virtual_chassis/default_config.json ]]; then
CHASS_CFG="-j /usr/share/sonic/virtual_chassis/default_config.json"
fi
# Note: libswsscommon requires a dabase_config file in /var/run/redis/sonic-db/
# Prepare this file before any dependent application, such as sonic-cfggen
mkdir -p /var/run/redis/sonic-db
cp /etc/default/sonic-db/database_config.json /var/run/redis/sonic-db/
SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
sonic-cfggen -t /usr/share/sonic/templates/init_cfg.json.j2 -a "{\"system_mac\": \"$SYSTEM_MAC_ADDRESS\"}" $CHASS_CFG > /etc/sonic/init_cfg.json
sonic-cfggen -t /usr/share/sonic/templates/init_cfg.json.j2 -a "{\"system_mac\": \"$SYSTEM_MAC_ADDRESS\"}" > /etc/sonic/init_cfg.json
if [[ -f /usr/share/sonic/virtual_chassis/default_config.json ]]; then
sonic-cfggen -j /etc/sonic/init_cfg.json -j /usr/share/sonic/virtual_chassis/default_config.json --print-data > /tmp/init_cfg.json
mv /tmp/init_cfg.json /etc/sonic/init_cfg.json
fi
if [ -f /etc/sonic/config_db.json ]; then
sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --print-data > /tmp/config_db.json