From 56a2bc5775ae104c27353d8fac4abafcc58324bf Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Nov 02 2023 13:47:50 +0000 Subject: The PKI JSON API the revocation reason key may be case-sensitive PKI 11.4.0 changed the reason keyword in the REST API from lower-case to camel-case in https://github.com/dogtagpki/pki/commit/926eb221ce6 Use Reason instead of reason as the keyword for revocations for PKI 11.4.0+ Related: https://pagure.io/freeipa/issue/9345 Signed-off-by: Rob Crittenden Reviewed-By: Florence Blanc-Renaud Reviewed-By: Thomas Woerner --- diff --git a/ipaserver/plugins/dogtag.py b/ipaserver/plugins/dogtag.py index 1c2c518..0036803 100644 --- a/ipaserver/plugins/dogtag.py +++ b/ipaserver/plugins/dogtag.py @@ -274,6 +274,8 @@ if six.PY3: logger = logging.getLogger(__name__) +pki_version = pki.util.Version(pki.specification_version()) + # These are general status return values used when # CMSServlet.outputError() is invoked. CMS_SUCCESS = 0 @@ -1130,7 +1132,11 @@ class ra(rabase.rabase, RestClient): serial_number = int(serial_number, 0) path = 'agent/certs/{}/revoke'.format(serial_number) - data = '{{"reason":"{}"}}'.format(reasons[revocation_reason]) + if pki_version < pki.util.Version("11.4.0"): + keyword = "reason" + else: + keyword = "Reason" + data = '{{"{}":"{}"}}'.format(keyword, reasons[revocation_reason]) http_status, _http_headers, http_body = self._ssldo( 'POST', path,