[PFCWD] Fix issue with "pfcwd show stats" command during SONiC init #1018
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Volodymyr Samotiy [email protected]
- What I did
Fixed issue with
pfcwd show stats
command during SONiC init.Traceback was returned if DB was not yet initialized which is incorrect. Correct behavior would to rather return empty line if something is not yet ready to be pulled and displayed.
- How I did it
Returned empty dictionary instead of
None
if data are still not present in DB. It is because in source code data expected to be as dictionary type but if there is no expected attributes in DBNone
was returned. Wich is incorrect and caused following exception:'NoneType' object has no attribute 'keys'
- How to verify it
Perform any type of reboot or config reload and once switch bootted but not fully initialized execute command
pfcwd show stats
. No exception or errors should be observed, just empty table.- Previous command output (if the output of a command-line utility has changed)
- New command output (if the output of a command-line utility has changed)