Skip to content

Commit e741c7c

Browse files
[PFCWD] Fix issue with "pfcwd show stats" command during SONiC init (sonic-net#1018)
- 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 DB None was returned. Wich is incorrect and caused following exception: 'NoneType' object has no attribute 'keys' Signed-off-by: Volodymyr Samotiy <[email protected]>
1 parent 2d9d00d commit e741c7c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pfcwd/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def cli():
3939

4040
def get_all_queues(db):
4141
queue_names = db.get_all(db.COUNTERS_DB, 'COUNTERS_QUEUE_NAME_MAP')
42-
return natsorted(queue_names.keys())
42+
return natsorted(queue_names.keys() if queue_names else {})
4343

4444
def get_all_ports(db):
4545
all_port_names = db.get_all(db.COUNTERS_DB, 'COUNTERS_PORT_NAME_MAP')

0 commit comments

Comments
 (0)