Hi All,

Please find the updated PATCH 0005.

On 07/01/2016 11:02 AM, Abhijeet Kasurde wrote:

Hi All,

Please review these patches.

Partially fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1351295

--
Thanks,
Abhijeet Kasurde

IRC: akasurde
http://akasurde.github.io



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

--
Thanks,
Abhijeet Kasurde

IRC: akasurde
http://akasurde.github.io

From 8b36e0a63c2c960e4fc399e1d611ad8774501a09 Mon Sep 17 00:00:00 2001
From: Abhijeet Kasurde <akasu...@redhat.com>
Date: Fri, 1 Jul 2016 10:05:05 +0530
Subject: [PATCH 5/5] Updated notification message for kra-db-vlv* command

Partially Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1351295

Signed-off-by: Abhijeet Kasurde <akasu...@redhat.com>
---
 base/server/python/pki/server/cli/kra.py | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/base/server/python/pki/server/cli/kra.py b/base/server/python/pki/server/cli/kra.py
index 17611a82b0e6c5eff910c2b4556e783da348d32f..10e2eb4bcb500d4486633190119e113997d09877 100644
--- a/base/server/python/pki/server/cli/kra.py
+++ b/base/server/python/pki/server/cli/kra.py
@@ -361,14 +361,15 @@ class KRADBVLVAddCLI(pki.cli.CLI):
             print('ERROR: Invalid instance %s.' % instance_name)
             sys.exit(1)
         instance.load()
-        self.add_vlv(instance, bind_dn, bind_password)
 
-    def add_vlv(self, instance, bind_dn, bind_password):
         subsystem = instance.get_subsystem('kra')
         if not subsystem:
-            print('No KRA subsystem available.')
-            return
+            print('ERROR: No KRA subsystem in instance %s.' % instance_name)
+            sys.exit(1)
 
+        self.add_vlv(subsystem, bind_dn, bind_password)
+
+    def add_vlv(self, subsystem, bind_dn, bind_password):
         if self.out_file:
             subsystem.customize_file(KRA_VLV_PATH, self.out_file)
             print('KRA VLVs written to ' + self.out_file)
@@ -386,11 +387,15 @@ class KRADBVLVAddCLI(pki.cli.CLI):
             for dn, entry in parser.all_records:
                 add_modlist = ldap.modlist.addModlist(entry)
                 conn.ldap.add_s(dn, add_modlist)
+        except ldap.ALREADY_EXISTS as e:# pylint: disable=W0612
+            print("KRA VLVs already exists in the database "
+                  "for " + subsystem.instance.name)
+            return
         finally:
             os.unlink(ldif_file.name)
             conn.close()
 
-        print('KRA VLVs added to the database for ' + instance.name)
+        print('KRA VLVs added to the database for ' + subsystem.instance.name)
 
 
 class KRADBVLVDeleteCLI(pki.cli.CLI):
@@ -581,16 +586,17 @@ class KRADBVLVReindexCLI(pki.cli.CLI):
             print('ERROR: Invalid instance %s.' % instance_name)
             sys.exit(1)
         instance.load()
-        self.reindex_vlv(instance, bind_dn, bind_password)
 
-    def reindex_vlv(self, instance, bind_dn, bind_password):
         subsystem = instance.get_subsystem('kra')
         if not subsystem:
-            if self.verbose:
-                print('reindex_vlv: No KRA subsystem available.  '
-                      'Skipping ...')
-                return
+            print('ERROR: No KRA subsystem in instance %s.' % instance_name)
+            sys.exit(1)
 
+        self.reindex_vlv(subsystem, bind_dn, bind_password)
+
+        print('KRA VLV reindex completed for ' + instance_name)
+
+    def reindex_vlv(self, subsystem, bind_dn, bind_password):
         if self.out_file:
             subsystem.customize_file(KRA_VLV_TASKS_PATH, self.out_file)
             print('KRA VLV reindex task written to ' + self.out_file)
@@ -602,7 +608,7 @@ class KRADBVLVReindexCLI(pki.cli.CLI):
         conn = subsystem.open_database(bind_dn=bind_dn,
                                        bind_password=bind_password)
 
-        print('Initiating KRA VLV reindex for ' + instance.name)
+        print('Initiating KRA VLV reindex for ' + subsystem.instance.name)
 
         try:
             parser = ldif.LDIFRecordList(open(ldif_file.name, "rb"))
@@ -630,5 +636,3 @@ class KRADBVLVReindexCLI(pki.cli.CLI):
         finally:
             os.unlink(ldif_file.name)
             conn.close()
-
-        print('KRA VLV reindex completed for ' + instance.name)
-- 
2.7.4

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

Reply via email to