Skip to content

Commit

Permalink
[show command] allow warm restart table contains empty restore_count (s…
Browse files Browse the repository at this point in the history
…onic-net#385)

* [show command] allow warm restart table contains empty restore_count

In practice, a software bug could cause not having restore_count, and
we could have use case (e.g. warm-shutdown) has state without
restore_count.

It would be nice that the command show all these rows without exception.

Signed-off-by: Ying Xie <ying.xie@microsoft.com>

* Remove extra spaces
  • Loading branch information
yxieca committed Nov 21, 2018
1 parent d0b8e3a commit 83ec276
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1624,9 +1624,12 @@ def remove_prefix(text, prefix):
entry = db.get_all(db.STATE_DB, tk)
r = []
r.append(remove_prefix(tk, prefix))
r.append(entry['restore_count'])
if 'restore_count' not in entry:
r.append("")
else:
r.append(entry['restore_count'])

if 'state' not in entry:
if 'state' not in entry:
r.append("")
else:
r.append(entry['state'])
Expand Down

0 comments on commit 83ec276

Please sign in to comment.