Skip to content

Commit

Permalink
[PFCWD] Fix issue with "pfcwd show stats" command during SONiC init (#…
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
volodymyrsamotiy authored and abdosi committed Sep 3, 2020
1 parent 3f6b59d commit ecb5c5d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pfcwd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def cli():

def get_all_queues(db):
queue_names = db.get_all(db.COUNTERS_DB, 'COUNTERS_QUEUE_NAME_MAP')
return natsorted(queue_names.keys())
return natsorted(queue_names.keys() if queue_names else {})

def get_all_ports(db):
all_port_names = db.get_all(db.COUNTERS_DB, 'COUNTERS_PORT_NAME_MAP')
Expand Down

0 comments on commit ecb5c5d

Please sign in to comment.