URL: https://github.com/freeipa/freeipa/pull/156
Author: jcholast
 Title: #156: cert: add revocation reason back to cert-find output
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/156/head:pr156
git checkout pr156
From 94c1a5b30136c51bdd518132d33148b862b4d68c Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
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
---
 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 e65cf1f..d13974e 100644
--- a/ipaserver/plugins/cert.py
+++ b/ipaserver/plugins/cert.py
@@ -1231,16 +1231,17 @@ def _ca_search(self, all, raw, pkey_only, sizelimit, exactly, **options):
                 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]
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to