From 05984f171b0b41681254c95380a0598e4208a201 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: May 04 2017 12:09:50 +0000 Subject: ca_status: add HTTP timeout 30 seconds CA sometimes "forgot to answer" so we have to add timeout for http connection and ask again rather than wait for infinity. https://pagure.io/freeipa/issue/6766 Reviewed-By: Stanislav Laznicka --- diff --git a/ipalib/constants.py b/ipalib/constants.py index e604bb4..5279b64 100644 --- a/ipalib/constants.py +++ b/ipalib/constants.py @@ -140,6 +140,8 @@ DEFAULT_CONFIG = ( # Time to wait for a service to start, in seconds ('startup_timeout', 300), + # How long http connection should wait for reply [seconds]. + ('http_timeout', 30), # Web Application mount points ('mount_ipa', '/ipa/'), diff --git a/ipapython/dogtag.py b/ipapython/dogtag.py index 21d58a9..28f78b5 100644 --- a/ipapython/dogtag.py +++ b/ipapython/dogtag.py @@ -123,7 +123,9 @@ def ca_status(ca_host=None): if ca_host is None: ca_host = api.env.ca_host status, _headers, body = http_request( - ca_host, 8080, '/ca/admin/ca/getStatus') + ca_host, 8080, '/ca/admin/ca/getStatus', + # timeout: CA sometimes forgot to answer, we have to try again + timeout=api.env.http_timeout) if status == 503: # Service temporarily unavailable return status