From 337faf506462a01c6dbcd00f2039ed5627691864 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Tue, 18 Nov 2014 19:49:15 +0100 Subject: Using wget to get status of CA This is just workaround Ticket: https://fedorahosted.org/freeipa/ticket/4676 Reviewed-By: Jan Cholasta --- ipapython/dogtag.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'ipapython') diff --git a/ipapython/dogtag.py b/ipapython/dogtag.py index 67180d59b..3d70bccfc 100644 --- a/ipapython/dogtag.py +++ b/ipapython/dogtag.py @@ -193,6 +193,16 @@ def get_ca_certchain(ca_host=None, dogtag_constants=None): return chain +def _parse_ca_status(body): + doc = xml.dom.minidom.parseString(body) + try: + item_node = doc.getElementsByTagName("XMLResponse")[0] + item_node = item_node.getElementsByTagName("Status")[0] + return item_node.childNodes[0].data + except IndexError: + raise error_from_xml(doc, _("Retrieving CA status failed: %s")) + + def ca_status(ca_host=None, use_proxy=True): """Return the status of the CA, and the httpd proxy in front of it @@ -216,13 +226,7 @@ def ca_status(ca_host=None, use_proxy=True): elif status != 200: raise errors.RemoteRetrieveError( reason=_("Retrieving CA status failed: %s") % reason) - doc = xml.dom.minidom.parseString(body) - try: - item_node = doc.getElementsByTagName("XMLResponse")[0] - item_node = item_node.getElementsByTagName("Status")[0] - return item_node.childNodes[0].data - except IndexError: - raise error_from_xml(doc, _("Retrieving CA status failed: %s")) + return _parse_ca_status(body) def https_request(host, port, url, secdir, password, nickname, **kw): -- cgit