diff options
| author | Amol Kahat <akahat@redhat.com> | 2016-06-21 12:47:23 +0530 |
|---|---|---|
| committer | Endi S. Dewata <edewata@redhat.com> | 2016-06-28 19:28:23 +0200 |
| commit | f0ab1c3d8bcd084ffe611e954b2d4f548f64cfd2 (patch) | |
| tree | 49216086b19ba5bf1a3dfe660f2b631759acc3b4 /base/server/python | |
| parent | e897fbd1b37d16d60858717f74e09952a45693d2 (diff) | |
| download | pki-f0ab1c3d8bcd084ffe611e954b2d4f548f64cfd2.tar.gz pki-f0ab1c3d8bcd084ffe611e954b2d4f548f64cfd2.tar.xz pki-f0ab1c3d8bcd084ffe611e954b2d4f548f64cfd2.zip | |
Fixes pki-server subsystem-* --help options.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1340718
Diffstat (limited to 'base/server/python')
| -rw-r--r-- | base/server/python/pki/server/cli/subsystem.py | 155 |
1 files changed, 81 insertions, 74 deletions
diff --git a/base/server/python/pki/server/cli/subsystem.py b/base/server/python/pki/server/cli/subsystem.py index 615b55e15..45f5be9b4 100644 --- a/base/server/python/pki/server/cli/subsystem.py +++ b/base/server/python/pki/server/cli/subsystem.py @@ -90,7 +90,7 @@ class SubsystemFindCLI(pki.cli.CLI): self.set_verbose(True) elif o == '--help': - self.print_help() + self.usage() sys.exit() else: @@ -138,12 +138,6 @@ class SubsystemShowCLI(pki.cli.CLI): self.usage() sys.exit(1) - if len(args) != 1: - print('ERROR: missing subsystem ID') - self.usage() - sys.exit(1) - - subsystem_name = args[0] instance_name = 'pki-tomcat' for o, a in opts: @@ -154,7 +148,7 @@ class SubsystemShowCLI(pki.cli.CLI): self.set_verbose(True) elif o == '--help': - self.print_help() + self.usage() sys.exit() else: @@ -162,6 +156,13 @@ class SubsystemShowCLI(pki.cli.CLI): self.usage() sys.exit(1) + if len(args) != 1: + print('ERROR: missing subsystem ID') + self.usage() + sys.exit(1) + + subsystem_name = args[0] + instance = pki.server.PKIInstance(instance_name) instance.load() @@ -195,12 +196,6 @@ class SubsystemEnableCLI(pki.cli.CLI): self.usage() sys.exit(1) - if len(args) != 1: - print('ERROR: missing subsystem ID') - self.usage() - sys.exit(1) - - subsystem_name = args[0] instance_name = 'pki-tomcat' for o, a in opts: @@ -211,7 +206,7 @@ class SubsystemEnableCLI(pki.cli.CLI): self.set_verbose(True) elif o == '--help': - self.print_help() + self.usage() sys.exit() else: @@ -219,6 +214,13 @@ class SubsystemEnableCLI(pki.cli.CLI): self.usage() sys.exit(1) + if len(args) != 1: + print('ERROR: missing subsystem ID') + self.usage() + sys.exit(1) + + subsystem_name = args[0] + instance = pki.server.PKIInstance(instance_name) instance.load() @@ -257,12 +259,6 @@ class SubsystemDisableCLI(pki.cli.CLI): self.usage() sys.exit(1) - if len(args) != 1: - print('ERROR: missing subsystem ID') - self.usage() - sys.exit(1) - - subsystem_name = args[0] instance_name = 'pki-tomcat' for o, a in opts: @@ -273,7 +269,7 @@ class SubsystemDisableCLI(pki.cli.CLI): self.set_verbose(True) elif o == '--help': - self.print_help() + self.usage() sys.exit() else: @@ -281,6 +277,13 @@ class SubsystemDisableCLI(pki.cli.CLI): self.usage() sys.exit(1) + if len(args) != 1: + print('ERROR: missing subsystem ID') + self.usage() + sys.exit(1) + + subsystem_name = args[0] + instance = pki.server.PKIInstance(instance_name) instance.load() @@ -342,12 +345,6 @@ class SubsystemCertFindCLI(pki.cli.CLI): self.print_help() sys.exit(1) - if len(args) != 1: - print('ERROR: missing subsystem ID') - self.print_help() - sys.exit(1) - - subsystem_name = args[0] instance_name = 'pki-tomcat' show_all = False @@ -370,6 +367,13 @@ class SubsystemCertFindCLI(pki.cli.CLI): self.print_help() sys.exit(1) + if len(args) != 1: + print('ERROR: missing subsystem ID') + self.print_help() + sys.exit(1) + + subsystem_name = args[0] + instance = pki.server.PKIInstance(instance_name) instance.load() @@ -414,18 +418,6 @@ class SubsystemCertShowCLI(pki.cli.CLI): self.usage() sys.exit(1) - if len(args) < 1: - print('ERROR: missing subsystem ID') - self.usage() - sys.exit(1) - - if len(args) < 2: - print('ERROR: missing cert ID') - self.usage() - sys.exit(1) - - subsystem_name = args[0] - cert_id = args[1] instance_name = 'pki-tomcat' for o, a in opts: @@ -436,7 +428,7 @@ class SubsystemCertShowCLI(pki.cli.CLI): self.set_verbose(True) elif o == '--help': - self.print_help() + self.usage() sys.exit() else: @@ -444,6 +436,20 @@ class SubsystemCertShowCLI(pki.cli.CLI): self.usage() sys.exit(1) + if len(args) < 1: + print('ERROR: missing subsystem ID') + self.usage() + sys.exit(1) + + + if len(args) < 2: + print('ERROR: missing cert ID') + self.usage() + sys.exit(1) + + subsystem_name = args[0] + cert_id = args[1] + instance = pki.server.PKIInstance(instance_name) instance.load() @@ -491,13 +497,6 @@ class SubsystemCertExportCLI(pki.cli.CLI): self.print_help() sys.exit(1) - if len(args) < 1: - print('ERROR: missing subsystem ID') - self.print_help() - sys.exit(1) - - subsystem_name = args[0] - instance_name = 'pki-tomcat' cert_file = None csr_file = None @@ -556,6 +555,13 @@ class SubsystemCertExportCLI(pki.cli.CLI): self.print_help() sys.exit(1) + if len(args) < 1: + print('ERROR: missing subsystem ID') + self.print_help() + sys.exit(1) + + subsystem_name = args[0] + if not (cert_file or csr_file or pkcs12_file): print('ERROR: missing output file') self.print_help() @@ -646,18 +652,6 @@ class SubsystemCertUpdateCLI(pki.cli.CLI): self.usage() sys.exit(1) - if len(args) < 1: - print('ERROR: missing subsystem ID') - self.usage() - sys.exit(1) - - if len(args) < 2: - print('ERROR: missing cert ID') - self.usage() - sys.exit(1) - - subsystem_name = args[0] - cert_id = args[1] instance_name = 'pki-tomcat' for o, a in opts: @@ -668,7 +662,7 @@ class SubsystemCertUpdateCLI(pki.cli.CLI): self.set_verbose(True) elif o == '--help': - self.print_help() + self.usage() sys.exit() else: @@ -676,6 +670,19 @@ class SubsystemCertUpdateCLI(pki.cli.CLI): self.usage() sys.exit(1) + if len(args) < 1: + print('ERROR: missing subsystem ID') + self.usage() + sys.exit(1) + + if len(args) < 2: + print('ERROR: missing cert ID') + self.usage() + sys.exit(1) + + subsystem_name = args[0] + cert_id = args[1] + instance = pki.server.PKIInstance(instance_name) instance.load() @@ -745,18 +752,6 @@ class SubsystemCertValidateCLI(pki.cli.CLI): self.usage() sys.exit(1) - if len(args) < 1: - print('ERROR: missing subsystem ID') - self.usage() - sys.exit(1) - - subsystem_name = args[0] - - if len(args) >=2: - cert_id = args[1] - else: - cert_id = None - instance_name = 'pki-tomcat' for o, a in opts: @@ -767,7 +762,7 @@ class SubsystemCertValidateCLI(pki.cli.CLI): self.set_verbose(True) elif o == '--help': - self.print_help() + self.usage() sys.exit() else: @@ -775,6 +770,18 @@ class SubsystemCertValidateCLI(pki.cli.CLI): self.usage() sys.exit(1) + if len(args) < 1: + print('ERROR: missing subsystem ID') + self.usage() + sys.exit(1) + + subsystem_name = args[0] + + if len(args) >=2: + cert_id = args[1] + else: + cert_id = None + instance = pki.server.PKIInstance(instance_name) instance.load() |
