Fix Redis connection over TLS

When Designate is configured to use Redis for coordination over a TLS connection, it will fail to connect with "ssl.SSLError: ('timed out',)".
This is caused by eventlet raising ssl.SSLError instead of the expected socket timeout the core libraries return.
This patch monkey-patches eventlet to return the proper exception.

Closes-Bug: #1989020
Change-Id: I5bd1c10d863212683752e05bb450e6f531ff7e72
This commit is contained in:
Michael Johnson 2022-09-07 18:40:24 +00:00
parent 7460ae30bf
commit 93dee6a3ff

@ -14,8 +14,15 @@
# License for the specific language governing permissions and limitations
# under the License.
import eventlet
from eventlet.green import ssl
import socket
eventlet.monkey_patch(os=False)
# Work around the eventlet issue that impacts redis using TLS.
# https://github.com/eventlet/eventlet/issues/692
ssl.timeout_exc = socket.timeout
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592