From d4271391adc45c781092db0fb89b802743a9dda8 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 11 Sep 2023 21:37:05 +0000 Subject: [PATCH] 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 --- ipaserver/plugins/dogtag.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ipaserver/plugins/dogtag.py b/ipaserver/plugins/dogtag.py index 1c2c51824eecb71cfa8146ceb30435c5ad5d79c7..0036803c86652b557ebeb3cd048877bc01a6b71a 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, -- 2.41.0