Temporary WA for the issue that asic_table.json can not be rendered (#13888)

- Why I did it
We suspect the issue #13791 is caused by redis server being temporarily unavailable during system initialization so we do not use -d in sonic-cfggen, for now, to avoid accessing redis server

- How I did it
Provide a string containing required json data when calling sonic-cfggen

- How to verify it
Manually test it

Signed-off-by: Stephen Sun <stephens@nvidia.com>
This commit is contained in:
Stephen Sun 2023-04-24 22:02:35 +08:00 committed by GitHub
parent 5ad844f185
commit 9e56fea091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -424,6 +424,7 @@ start() {
if [[ $? -ne 0 ]] ; then
echo "sonic-cfggen failed to render asic_table.json"
echo "$(cat errorlog.txt)"
sonic-cfggen -a '{"DEVICE_METADATA":{"localhost":{"platform":"'$PLATFORM'"}}}' -t /usr/share/sonic/templates/asic_table.j2 > /etc/sonic/asic_table.json
fi
fi
if [ ! -f /etc/sonic/peripheral_table.json ] && [ -f /usr/share/sonic/device/$PLATFORM/port_peripheral_config.j2 ]; then
@ -431,6 +432,7 @@ start() {
if [[ $? -ne 0 ]] ; then
echo "sonic-cfggen failed to render peripheral_table.json"
echo "$(cat errorlog.txt)"
sonic-cfggen -a '{"DEVICE_METADATA":{"localhost":{"platform":"'$PLATFORM'"}}}' -t /usr/share/sonic/device/$PLATFORM/port_peripheral_config.j2 > /etc/sonic/peripheral_table.json
fi
fi
if [ ! -f /etc/sonic/zero_profiles.json ] && [ -f /usr/share/sonic/templates/zero_profiles.j2 ]; then
@ -438,6 +440,7 @@ start() {
if [[ $? -ne 0 ]] ; then
echo "sonic-cfggen failed to render zero_profiles.json"
echo "$(cat errorlog.txt)"
sonic-cfggen -t /usr/share/sonic/device/$PLATFORM/zero_profiles.j2 > /etc/sonic/zero_profiles.json
fi
fi