Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sonic-db-cli] Fix sonic-db-cli crash when database config file not r…
…eady issue. (#701) #### Why I did it Fix sonic-db-cli PING/SAVE/FLUSHALL command crash when database config file not ready issue: sonic-net/sonic-buildimage#12047 #### How I did it When run PING/SAVE/FLUSHALL command, catch database initialize failed exception and return 1. #### How to verify it Pass all existing UT and E2E test. Add new UT to cover changed code. Manually test, sonic-db-cli will return 1 when run PING command and can't find config file: azureuser@a7f66d2b794c:/sonic/src/sonic-swss-common$ ./sonic-db-cli/sonic-db-cli PING An exception of type Sonic database config file doesn't exist at /var/run/redis/sonic-db/database_config.json occurred. Arguments: /sonic/src/sonic-swss-common/sonic-db-cli/.libs/sonic-db-cli PING azureuser@a7f66d2b794c:/sonic/src/sonic-swss-common$ echo $? 1 #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [x] 202111 - [x] 202205 #### Description for the changelog Fix sonic-db-cli PING/SAVE/FLUSHALL command crash when database config file not ready issue. #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/SONiC/wiki/Configuration. --> #### A picture of a cute animal (not mandatory but encouraged)
- Loading branch information