mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 06:51:10 +03:00
Merge pull request #5611 from kdelee/awxkit-better-timeout-error
[awxkit] Raise a more informative error when timeout Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
1c09114abd
@ -4,6 +4,7 @@ import json
|
||||
import six
|
||||
|
||||
from awxkit.utils import poll_until
|
||||
from awxkit.exceptions import WaitUntilTimeout
|
||||
|
||||
|
||||
def bytes_to_str(obj):
|
||||
@ -28,7 +29,11 @@ class HasStatus(object):
|
||||
|
||||
def wait_until_status(self, status, interval=1, timeout=60, **kwargs):
|
||||
status = [status] if not isinstance(status, (list, tuple)) else status
|
||||
try:
|
||||
poll_until(lambda: getattr(self.get(), 'status') in status, interval=interval, timeout=timeout, **kwargs)
|
||||
except WaitUntilTimeout:
|
||||
# This will raise a more informative error than just "WaitUntilTimeout" error
|
||||
self.assert_status(status)
|
||||
return self
|
||||
|
||||
def wait_until_completed(self, interval=5, timeout=60, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user