Re: [Pki-devel] [PATCH 0010] Added instance and subsystem validation for pki-server subsystem-* commands.

2016-07-06 Thread Abhijeet Kasurde

Sure, Matthew. I will take a note of that.


On 07/06/2016 09:24 PM, Matthew Harmsen wrote:

On 07/06/2016 09:30 AM, Endi Sukma Dewata wrote:

On 7/2/2016 12:48 AM, Abhijeet Kasurde wrote:

Hi All,

Please review the patch.

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


Thanks! Pushed to master under this ticket:
https://fedorahosted.org/pki/ticket/2399


Abhijeet,

Since we are now on the 10.3.5 milestone, please begin referencing the 
following bug:


  * Bugzilla Bug #1353245 - Dogtag 10.3.5: Miscellaneous Enhancements


This was cloned from PKI TRAC Ticket #2399 - Dogtag 10.3.5: 
Miscellaneous Enhancements  
which Endi correctly identified; I have added the check-in hash to 
both the bug and the ticket.


Thanks,
-- Matt



--
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

Re: [Pki-devel] [PATCH 0010] Added instance and subsystem validation for pki-server subsystem-* commands.

2016-07-06 Thread Matthew Harmsen

On 07/06/2016 09:30 AM, Endi Sukma Dewata wrote:

On 7/2/2016 12:48 AM, Abhijeet Kasurde wrote:

Hi All,

Please review the patch.

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


Thanks! Pushed to master under this ticket:
https://fedorahosted.org/pki/ticket/2399


Abhijeet,

Since we are now on the 10.3.5 milestone, please begin referencing the 
following bug:


 * Bugzilla Bug #1353245 - Dogtag 10.3.5: Miscellaneous Enhancements
   

This was cloned from PKI TRAC Ticket #2399 - Dogtag 10.3.5: 
Miscellaneous Enhancements  
which Endi correctly identified; I have added the check-in hash to both 
the bug and the ticket.


Thanks,
-- Matt

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

Re: [Pki-devel] [PATCH 0010] Added instance and subsystem validation for pki-server subsystem-* commands.

2016-07-06 Thread Endi Sukma Dewata

On 7/2/2016 12:48 AM, Abhijeet Kasurde wrote:

Hi All,

Please review the patch.

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


Thanks! Pushed to master under this ticket:
https://fedorahosted.org/pki/ticket/2399

--
Endi S. Dewata

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


[Pki-devel] [PATCH 0010] Added instance and subsystem validation for pki-server subsystem-* commands.

2016-07-01 Thread Abhijeet Kasurde

Hi All,

Please review the patch.

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

--
Thanks,
Abhijeet Kasurde

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

From 4660a338745020cf773e8e22d6da3552cb014cc2 Mon Sep 17 00:00:00 2001
From: Abhijeet Kasurde 
Date: Sat, 2 Jul 2016 11:03:53 +0530
Subject: [PATCH] Added instance and subsystem validation for pki-server
 subsystem-* commands.

The pki-server subsystem-* commands have been updated to validate
the instance and subsystem before proceeding with the operation.

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

Signed-off-by: Abhijeet Kasurde 
---
 base/server/python/pki/server/cli/subsystem.py | 66 +-
 1 file changed, 53 insertions(+), 13 deletions(-)

diff --git a/base/server/python/pki/server/cli/subsystem.py b/base/server/python/pki/server/cli/subsystem.py
index 49215cf46a56ac984bdd5b8ad54e618a7b04393e..a44243a6788fc21d705055ec6bf4f1bc9e372475 100644
--- a/base/server/python/pki/server/cli/subsystem.py
+++ b/base/server/python/pki/server/cli/subsystem.py
@@ -177,6 +177,10 @@ class SubsystemShowCLI(pki.cli.CLI):
 instance.load()
 
 subsystem = instance.get_subsystem(subsystem_name)
+if not subsystem:
+print('ERROR: No %s subsystem in instance '
+  '%s.' % (subsystem_name, instance_name))
+sys.exit(1)
 
 SubsystemCLI.print_subsystem(subsystem)
 
@@ -240,9 +244,17 @@ class SubsystemEnableCLI(pki.cli.CLI):
 instance.load()
 
 subsystem = instance.get_subsystem(subsystem_name)
-subsystem.enable()
+if not subsystem:
+print('ERROR: No %s subsystem in instance '
+  '%s.' % (subsystem_name, instance_name))
+sys.exit(1)
 
-self.print_message('Enabled "%s" subsystem' % subsystem_name)
+if subsystem.is_enabled():
+self.print_message('Subsystem "%s" is already '
+   'enabled' % subsystem_name)
+else:
+subsystem.enable()
+self.print_message('Enabled "%s" subsystem' % subsystem_name)
 
 SubsystemCLI.print_subsystem(subsystem)
 
@@ -308,9 +320,17 @@ class SubsystemDisableCLI(pki.cli.CLI):
 instance.load()
 
 subsystem = instance.get_subsystem(subsystem_name)
-subsystem.disable()
+if not subsystem:
+print('ERROR: No %s subsystem in instance '
+  '%s.' % (subsystem_name, instance_name))
+sys.exit(1)
 
-self.print_message('Disabled "%s" subsystem' % subsystem_name)
+if not subsystem.is_enabled():
+self.print_message('Subsystem "%s" is already '
+   'disabled' % subsystem_name)
+else:
+subsystem.disable()
+self.print_message('Disabled "%s" subsystem' % subsystem_name)
 
 SubsystemCLI.print_subsystem(subsystem)
 
@@ -403,6 +423,10 @@ class SubsystemCertFindCLI(pki.cli.CLI):
 instance.load()
 
 subsystem = instance.get_subsystem(subsystem_name)
+if not subsystem:
+print('ERROR: No %s subsystem in instance '
+  '%s.' % (subsystem_name, instance_name))
+sys.exit(1)
 results = subsystem.find_system_certs()
 
 self.print_message('%s entries matched' % len(results))
@@ -436,7 +460,7 @@ class SubsystemCertShowCLI(pki.cli.CLI):
 
 try:
 opts, args = getopt.gnu_getopt(argv, 'i:v', [
-'instance=',  'show-all',
+'instance=', 'show-all',
 'verbose', 'help'])
 
 except getopt.GetoptError as e:
@@ -471,7 +495,6 @@ class SubsystemCertShowCLI(pki.cli.CLI):
 self.usage()
 sys.exit(1)
 
-
 if len(args) < 2:
 print('ERROR: missing cert ID')
 self.usage()
@@ -489,6 +512,10 @@ class SubsystemCertShowCLI(pki.cli.CLI):
 instance.load()
 
 subsystem = instance.get_subsystem(subsystem_name)
+if not subsystem:
+print('ERROR: No %s subsystem in instance '
+  '%s.' % (subsystem_name, instance_name))
+sys.exit(1)
 cert = subsystem.get_subsystem_cert(cert_id)
 
 SubsystemCertCLI.print_subsystem_cert(cert, show_all)
@@ -611,6 +638,10 @@ class SubsystemCertExportCLI(pki.cli.CLI):
 instance.load()
 
 subsystem = instance.get_subsystem(subsystem_name)
+if not subsystem:
+print('ERROR: No %s subsystem in instance '
+  '%s.' % (subsystem_name, instance_name))
+sys.exit(1)
 subsystem_cert = None
 
 if len(args) >= 2:
@@ -732,6 +763,10 @@ class SubsystemCertUpdateCLI(pki.cli.CLI):
 instance.load()
 
 subsystem = instance.get_subsystem(subsystem_name)
+if not subsystem:
+print('ERROR: No %s subsystem in instance '
+  '%s.' % (subsyste