[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)
This commit is contained in:
Alex Schultz 2020-06-04 14:14:38 -06:00
parent a778fb84ab
commit ac5d1d906a
1 changed files with 7 additions and 0 deletions

View File

@ -158,6 +158,13 @@ class WebsocketClient(object):
raise exceptions.WebSocketTimeout() raise exceptions.WebSocketTimeout()
except websocket.WebSocketConnectionClosedException: except websocket.WebSocketConnectionClosedException:
raise exceptions.WebSocketConnectionClosed() 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): def __enter__(self):
"""Return self to allow usage as a context manager""" """Return self to allow usage as a context manager"""