Reconnect on httplib.ResponseNotReady

In CI we get a random ResponseNotReady exception,
which is caused by the server closing the keepalive socket.
This will close and retry the connection.

Change-Id: I28e51450cbfea8bf7a18e5783355b68f806eb999
This commit is contained in:
Grzegorz Grasza 2018-11-13 11:51:41 +01:00
parent 45275db240
commit e8ced3d13c
1 changed files with 10 additions and 0 deletions

View File

@ -17,6 +17,9 @@ import os
import time import time
import uuid import uuid
from six.moves import http_client
try: try:
from gssapi.exceptions import GSSError from gssapi.exceptions import GSSError
from ipalib import api from ipalib import api
@ -161,6 +164,13 @@ class IPANovaJoinBase(object):
tries += 1 tries += 1
if self.backoff: if self.backoff:
self.__backoff() self.__backoff()
except http_client.ResponseNotReady:
# NOTE(xek): This means that the server closed the socket,
# so keep-alive ended and we can't use that connection.
api.Backend.rpcclient.disconnect()
tries += 1
if self.backoff:
self.__backoff()
else: else:
return return