Include response body in the exception message, specify default value for poll_interval and timeout argument.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4a742436 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4a742436 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4a742436 Branch: refs/heads/trunk Commit: 4a742436775f83d73c6f0b2a762c6fe2f777c6f1 Parents: 8f89e78 Author: Tomaz Muraus <to...@apache.org> Authored: Thu Nov 12 23:49:50 2015 +0100 Committer: Tomaz Muraus <to...@apache.org> Committed: Thu Nov 12 23:49:50 2015 +0100 ---------------------------------------------------------------------- libcloud/common/dimensiondata.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/4a742436/libcloud/common/dimensiondata.py ---------------------------------------------------------------------- diff --git a/libcloud/common/dimensiondata.py b/libcloud/common/dimensiondata.py index 58c35c8..90e6690 100644 --- a/libcloud/common/dimensiondata.py +++ b/libcloud/common/dimensiondata.py @@ -218,8 +218,8 @@ class DimensionDataConnection(ConnectionUserAndKey): return ("%s/%s/%s" % (self.api_path_version_2, self.api_version_2, self._get_orgId())) - def wait_for_state(self, state, func, poll_interval, - timeout, *args, **kwargs): + def wait_for_state(self, state, func, poll_interval=2, timeout=60, *args, + **kwargs): """ Wait for the function which returns a instance with field status to match @@ -251,8 +251,10 @@ class DimensionDataConnection(ConnectionUserAndKey): return response sleep(poll_interval) cnt += 1 + + msg = 'Status check timed out: %s' % (response.body) raise DimensionDataAPIException(code=response.status, - msg="Status check timed out", + msg=msg, driver=self.connection.driver) def _get_orgId(self):