Browse Source

[TRAIN-AND-OLDER] Improve timeout error handling

For many releases we have seen overall deployment and workflow exections
that timeout throw a json decode error. This is usually because either
the mistral execution completely failed (unhandled exception),
something during the deployment hangs (bad network config), or the
--timeout was less than the time it takes to run an action. If we get an
exception waiting for timeouts that isn't already a websocket timeout or
something to that effect, we should catch it and print some useful
messaging that the user can use to begin their troubleshooting.

Change-Id: Ie239f3fc11bbf95dc9af9786b288f6e8aef1193a
Closes-Bug: #1882134
(cherry picked from commit ecf2241668)
Alex Schultz 1 month ago
1 changed files with 7 additions and 0 deletions
  1. +7

+ 7
- 0
tripleoclient/ View File

@@ -158,6 +158,13 @@ class WebsocketClient(object):
raise exceptions.WebSocketTimeout()
except websocket.WebSocketConnectionClosedException:
raise exceptions.WebSocketConnectionClosed()
except Exception as e:
err = ("An exception occurred while waiting for messages. "
"This can indicate a timeout or a failure in the "
"workflow execution. To troubleshoot, check the "
"workflow executions for failures and/or the "
"ansible logs. Exception: {0!r}".format(e))
raise exceptions.WorkflowServiceError(err)

def __enter__(self):
"""Return self to allow usage as a context manager"""