Skip to content

Commit 794cdd3

Browse files
authored
Fix: initialize SonicDBConfig differently for single or multi_asic (sonic-net#1409)
**- What I did** Fixes sonic-net#6708 This bug is exposed by sonic-net/sonic-utilities#1392. Previously the `config` command will call `SonicDBConfig.load_sonic_global_db_config()` even on a single ASIC platform, and it will silently failed. After exposed, it will fail with error syslog message: ``` admin@sonic:~$ sudo config save Existing files will be overwritten, continue? [y/N]: ^CAborted! Feb 8 03:23:48.729434 sonic ERR sniffer: :- initializeGlobalConfig: Sonic database config global file doesn't exist at /var/run/redis/sonic-db/database_global.json ``` **- How to verify it** Tested on DUT
1 parent 16b2274 commit 794cdd3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

config/main.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,11 @@ def config(ctx):
931931
platform.add_command(mlnx.mlnx)
932932

933933
# Load the global config file database_global.json once.
934-
SonicDBConfig.load_sonic_global_db_config()
934+
num_asic = multi_asic.get_num_asics()
935+
if num_asic > 1:
936+
SonicDBConfig.load_sonic_global_db_config()
937+
else:
938+
SonicDBConfig.initialize()
935939

936940
if os.geteuid() != 0:
937941
exit("Root privileges are required for this operation")

0 commit comments

Comments
 (0)