Skip to content

Commit

Permalink
Fix: initialize SonicDBConfig differently for single or multi_asic (s…
Browse files Browse the repository at this point in the history
…onic-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
  • Loading branch information
qiluo-msft committed Feb 8, 2021
1 parent 16b2274 commit 794cdd3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,11 @@ def config(ctx):
platform.add_command(mlnx.mlnx)

# Load the global config file database_global.json once.
SonicDBConfig.load_sonic_global_db_config()
num_asic = multi_asic.get_num_asics()
if num_asic > 1:
SonicDBConfig.load_sonic_global_db_config()
else:
SonicDBConfig.initialize()

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

0 comments on commit 794cdd3

Please sign in to comment.