diff options
Diffstat (limited to 'ipapython')
-rw-r--r-- | ipapython/dogtag.py | 18 |
1 files changed, 11 insertions, 7 deletions
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): |