Skip to content

Commit

Permalink
Use .get with defaults instead of [] to avoid ApiAttributeError on mi…
Browse files Browse the repository at this point in the history
…ssing timeStamp or message. PAASTA-17100
  • Loading branch information
EvanKrall committed Nov 3, 2020
1 parent b293d9b commit 0f5dfad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion paasta_tools/kubernetes_tools.py
Expand Up @@ -1912,7 +1912,9 @@ def format_pod_event_messages(
rows: List[str] = list()
rows.append(PaastaColors.blue(f"Pod Events for {pod_name}"))
for message in pod_event_messages:
rows.append(f" Event at {message['timeStamp']}: {message['message']}")
timestamp = message.get("timeStamp", "unknown time")
message_text = message.get("message", "")
rows.append(f" Event at {timestamp}: {message_text}")
return rows


Expand Down

0 comments on commit 0f5dfad

Please sign in to comment.