From ac5d1d906ac2cc7212273105df8455e5144abbc4 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Thu, 4 Jun 2020 14:14:38 -0600 Subject: [PATCH] [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 ecf22416686ace0bfeb1631f15ba2978c3b8c929) --- tripleoclient/plugin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tripleoclient/plugin.py b/tripleoclient/plugin.py index 5f92c6976..bd4e3e415 100644 --- a/tripleoclient/plugin.py +++ b/tripleoclient/plugin.py @@ -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"""