Hi,

I fixes bugzilla issue no 1339263.
Please review this patch.

PFA.

Thank You.

Amol K.

>From caf7e6c692fcd626d572ec31352d87ff3b507a8e Mon Sep 17 00:00:00 2001
From: Amol Kahat <aka...@redhat.com>
Date: Thu, 9 Jun 2016 16:34:22 +0530
Subject: [PATCH] Description : Fixed --help option for instance-show,
 instance-start, instance-stop, instance-migrate, instance-nuxwdog-enable,
 instance-nuxwdog-disable.

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

Signed-off-by: Amol Kahat <aka...@redhat.com>
---
 base/server/python/pki/server/cli/instance.py | 86 +++++++++++++--------------
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/base/server/python/pki/server/cli/instance.py b/base/server/python/pki/server/cli/instance.py
index 7520b32b81cf222ebc7ac1def928701b1116ae86..d5fc644a1d9ae992907aed8674c793e26bdc0ef8 100644
--- a/base/server/python/pki/server/cli/instance.py
+++ b/base/server/python/pki/server/cli/instance.py
@@ -261,13 +261,6 @@ class InstanceShowCLI(pki.cli.CLI):
             self.print_help()
             sys.exit(1)
 
-        if len(args) != 1:
-            print('ERROR: missing instance ID')
-            self.print_help()
-            sys.exit(1)
-
-        instance_name = args[0]
-
         for o, _ in opts:
             if o in ('-v', '--verbose'):
                 self.set_verbose(True)
@@ -281,6 +274,13 @@ class InstanceShowCLI(pki.cli.CLI):
                 self.print_help()
                 sys.exit(1)
 
+        if len(args) != 1:
+            print('ERROR: missing instance ID')
+            self.print_help()
+            sys.exit(1)
+
+        instance_name = args[0]
+
         instance = pki.server.PKIInstance(instance_name)
         instance.load()
 
@@ -310,13 +310,6 @@ class InstanceStartCLI(pki.cli.CLI):
             self.print_help()
             sys.exit(1)
 
-        if len(args) != 1:
-            print('ERROR: missing instance ID')
-            self.print_help()
-            sys.exit(1)
-
-        instance_name = args[0]
-
         for o, _ in opts:
             if o in ('-v', '--verbose'):
                 self.set_verbose(True)
@@ -330,6 +323,13 @@ class InstanceStartCLI(pki.cli.CLI):
                 self.print_help()
                 sys.exit(1)
 
+        if len(args) != 1:
+            print('ERROR: missing instance ID')
+            self.print_help()
+            sys.exit(1)
+
+        instance_name = args[0]
+
         instance = pki.server.PKIInstance(instance_name)
         instance.load()
         instance.start()
@@ -360,13 +360,6 @@ class InstanceStopCLI(pki.cli.CLI):
             self.print_help()
             sys.exit(1)
 
-        if len(args) != 1:
-            print('ERROR: missing instance ID')
-            self.print_help()
-            sys.exit(1)
-
-        instance_name = args[0]
-
         for o, _ in opts:
             if o in ('-v', '--verbose'):
                 self.set_verbose(True)
@@ -380,6 +373,13 @@ class InstanceStopCLI(pki.cli.CLI):
                 self.print_help()
                 sys.exit(1)
 
+        if len(args) != 1:
+            print('ERROR: missing instance ID')
+            self.print_help()
+            sys.exit(1)
+
+        instance_name = args[0]
+
         instance = pki.server.PKIInstance(instance_name)
         instance.load()
         instance.stop()
@@ -412,14 +412,6 @@ class InstanceMigrateCLI(pki.cli.CLI):
             self.print_help()
             sys.exit(1)
 
-        if len(args) != 1:
-            print('ERROR: missing instance ID')
-            self.print_help()
-            sys.exit(1)
-
-        instance_name = args[0]
-        tomcat_version = None
-
         for o, a in opts:
             if o == '--tomcat':
                 tomcat_version = a
@@ -440,6 +432,14 @@ class InstanceMigrateCLI(pki.cli.CLI):
                 self.print_help()
                 sys.exit(1)
 
+        if len(args) != 1:
+            print('ERROR: missing instance ID')
+            self.print_help()
+            sys.exit(1)
+
+        instance_name = args[0]
+        tomcat_version = None
+
         if not tomcat_version:
             tomcat_version = pki.server.Tomcat.get_major_version()
 
@@ -484,13 +484,6 @@ class InstanceNuxwdogEnableCLI(pki.cli.CLI):
             self.print_help()
             sys.exit(1)
 
-        if len(args) != 1:
-            print('ERROR: missing instance ID')
-            self.print_help()
-            sys.exit(1)
-
-        instance_name = args[0]
-
         for o, _ in opts:
             if o in ('-v', '--verbose'):
                 self.set_verbose(True)
@@ -502,6 +495,13 @@ class InstanceNuxwdogEnableCLI(pki.cli.CLI):
                 self.print_help()
                 sys.exit(1)
 
+        if len(args) != 1:
+            print('ERROR: missing instance ID')
+            self.print_help()
+            sys.exit(1)
+
+        instance_name = args[0]
+
         module = self.get_top_module().find_module('nuxwdog-enable')
         module = pki.server.cli.nuxwdog.NuxwdogEnableCLI()
         module.set_verbose(self.verbose)
@@ -539,13 +539,6 @@ class InstanceNuxwdogDisableCLI(pki.cli.CLI):
             self.print_help()
             sys.exit(1)
 
-        if len(args) != 1:
-            print('ERROR: missing instance ID')
-            self.print_help()
-            sys.exit(1)
-
-        instance_name = args[0]
-
         for o, _ in opts:
             if o in ('-v', '--verbose'):
                 self.set_verbose(True)
@@ -557,6 +550,13 @@ class InstanceNuxwdogDisableCLI(pki.cli.CLI):
                 self.print_help()
                 sys.exit(1)
 
+        if len(args) != 1:
+            print('ERROR: missing instance ID')
+            self.print_help()
+            sys.exit(1)
+
+        instance_name = args[0]
+
         module = self.get_top_module().find_module('nuxwdog-disable')
         module.set_verbose(self.verbose)
 
-- 
2.5.5

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

Reply via email to