This patch fixes the following ticket:
https://fedorahosted.org/pki/ticket/1519 TPS UI lists the certs on the token when the token is in uninitialized state

It deletes certificates from token record when the token is formatted.

thanks,
Christina
>From ce8a39a071b790e228f7a8e256d11e495659ae25 Mon Sep 17 00:00:00 2001
From: Christina Fu <c...@redhat.com>
Date: Tue, 5 Apr 2016 15:57:38 -0700
Subject: [PATCH] Ticket #1519 token format should delete certs from token
 record

---
 .../src/org/dogtagpki/server/tps/processor/TPSProcessor.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java b/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java
index 53af08a05dad54f3c81a82d5d0bfc72add54565c..215109f3bd7c0890affca8a298c92a18d2eb6c9d 100644
--- a/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java
+++ b/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java
@@ -2141,6 +2141,16 @@ public class TPSProcessor {
             }
         }
 
+       try {
+            // clean up the cert records used to belong to this token in tokendb
+            tps.tdb.tdbRemoveCertificatesByCUID(tokenRecord.getId());
+            CMS.debug("TPSProcessor.format: tdbRemoveCertificatesByCUID() done");
+        } catch (Exception e) {
+            logMsg = "Attempt to clean up record with tdbRemoveCertificatesByCUID failed; token probably clean; continue anyway:"
+                    + e;
+            CMS.debug("TPSProcessor.format: " + logMsg);
+        }
+
         // Update Token DB
         tokenRecord.setStatus("uninitialized");
         try {
-- 
2.4.3

_______________________________________________
Pki-devel mailing list
Pki-devel@redhat.com
https://www.redhat.com/mailman/listinfo/pki-devel

Reply via email to