From c3ceffccc56dea782a3dfac5bc3a14d1d022d33a Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Wed, 12 Oct 2016 12:58:46 +0200 Subject: [PATCH] cert: add revocation reason back to cert-find output In commit c718ef058847bb39e78236e8af0ad69ac961bbcf some param values were accidentally removed from cert-find output. In commit 22d5f579bbd8bb452cf1bf620294ab6ade6e7c47 `serial_number_hex` and `revoked` were added back. Add back `revocation_reason` as well. Also, do not include `revoked` with --raw, as it's a virtual attribute. https://fedorahosted.org/freeipa/ticket/6269 Reviewed-By: Pavel Vomacka --- ipaserver/plugins/cert.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ipaserver/plugins/cert.py b/ipaserver/plugins/cert.py index 00bae4560d601e28e0b983786bff9144bcc1b065..68516391a54aead8e92f3cdeb33463d8fa624bbd 100644 --- a/ipaserver/plugins/cert.py +++ b/ipaserver/plugins/cert.py @@ -1098,16 +1098,17 @@ class cert_find(Search, CertMethod): obj = {'serial_number': serial_number} else: obj = ra_obj - obj['issuer'] = issuer - obj['subject'] = DN(ra_obj['subject']) - obj['revoked'] = ( - ra_obj['status'] in (u'REVOKED', u'REVOKED_EXPIRED')) - if all: - ra_obj = ra.get_certificate(str(serial_number)) - if not raw: + obj.update(ra.get_certificate(str(serial_number))) + + if not raw: + obj['issuer'] = issuer + obj['subject'] = DN(ra_obj['subject']) + obj['revoked'] = ( + ra_obj['status'] in (u'REVOKED', u'REVOKED_EXPIRED')) + if all: obj['certificate'] = ( - ra_obj['certificate'].replace('\r\n', '')) + obj['certificate'].replace('\r\n', '')) self.obj._parse(obj) obj['cacn'] = ca_obj['cn'][0] -- 2.10.2