Skip to content

Commit 03d6a96

Browse files
committed
vlm_cmd: Fix trying to display None type percentage
1 parent 84cd081 commit 03d6a96

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

linstor_client/commands/vlm_cmds.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,14 @@ def volume_state_cell(vlm, rsc_flags):
190190

191191
@classmethod
192192
def color_repl_state(cls, tbl, replication_state, done_percentage):
193+
disp_perc = "?" if done_percentage is None else "{p:.2f}%".format(p=done_percentage)
193194
repl_state = replication_state
194-
if replication_state in ["SyncTarget", "PausedSyncS", "PausedSyncT", "WFBitMapS", "WFBitMapT", "Unknown"]:
195-
repl_state = tbl.color_cell("{s}({p:.2f}%)".format(s=replication_state, p=done_percentage), Color.YELLOW)
195+
if replication_state in ["WFBitMapS", "WFBitMapT", "Unknown"]:
196+
repl_state = tbl.color_cell("{s}".format(s=replication_state))
197+
if replication_state in ["SyncTarget", "PausedSyncS", "PausedSyncT"]:
198+
repl_state = tbl.color_cell("{s}({p})".format(s=replication_state, p=disp_perc), Color.YELLOW)
196199
elif replication_state in ["VerifyT"]:
197-
repl_state = tbl.color_cell("{s}({p:.2f}%)".format(s=replication_state, p=done_percentage), Color.GRAY)
200+
repl_state = tbl.color_cell("{s}({p})".format(s=replication_state, p=disp_perc), Color.GRAY)
198201
elif replication_state == "Established":
199202
repl_state = tbl.color_cell(replication_state, Color.GREEN)
200203
return repl_state

0 commit comments

Comments
 (0)