summaryrefslogtreecommitdiffstats
path: root/base/server/python/pki/server/cli/instance.py
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2015-10-27 02:56:21 +0100
committerEndi S. Dewata <edewata@redhat.com>2015-10-30 19:02:56 +0100
commitc7bc6eb94aa64c89467f9394554f860dc485ad94 (patch)
treec2de2f28f0195a2d4c0744f660252ebb5a568fb1 /base/server/python/pki/server/cli/instance.py
parent8b5c3cf9b37e5b3be44b777545fb1887c2fb75d2 (diff)
downloadpki-c7bc6eb94aa64c89467f9394554f860dc485ad94.tar.gz
pki-c7bc6eb94aa64c89467f9394554f860dc485ad94.tar.xz
pki-c7bc6eb94aa64c89467f9394554f860dc485ad94.zip
Added automatic Tomcat migration.
The pki-core.spec has been modified to execute pki-server migrate when the package is installed. This way when upgrading from F22 to F23 all PKI instances will be migrated automatically to Tomcat 8. The pki-server migrate command has been modified such that if there is no specific Tomcat version specified it will use the current Tomcat version. The top attribute in the CLI class was not functioning properly, so it has been replaced with get_top_module() method. The getopt() invocations in pki-server subcommands have been replaced with gnu_getopt() to allow intermixing options and arguments. https://fedorahosted.org/pki/ticket/1310
Diffstat (limited to 'base/server/python/pki/server/cli/instance.py')
-rw-r--r--base/server/python/pki/server/cli/instance.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/base/server/python/pki/server/cli/instance.py b/base/server/python/pki/server/cli/instance.py
index f74d251ca..fe50b605d 100644
--- a/base/server/python/pki/server/cli/instance.py
+++ b/base/server/python/pki/server/cli/instance.py
@@ -65,7 +65,7 @@ class InstanceFindCLI(pki.cli.CLI):
def execute(self, argv):
try:
- opts, _ = getopt.getopt(argv, 'i:v', [
+ opts, _ = getopt.gnu_getopt(argv, 'i:v', [
'verbose', 'help'])
except getopt.GetoptError as e:
@@ -125,7 +125,7 @@ class InstanceShowCLI(pki.cli.CLI):
def execute(self, argv):
try:
- opts, args = getopt.getopt(argv, 'i:v', [
+ opts, args = getopt.gnu_getopt(argv, 'i:v', [
'verbose', 'help'])
except getopt.GetoptError as e:
@@ -174,7 +174,7 @@ class InstanceStartCLI(pki.cli.CLI):
def execute(self, argv):
try:
- opts, args = getopt.getopt(argv, 'i:v', [
+ opts, args = getopt.gnu_getopt(argv, 'i:v', [
'verbose', 'help'])
except getopt.GetoptError as e:
@@ -224,7 +224,7 @@ class InstanceStopCLI(pki.cli.CLI):
def execute(self, argv):
try:
- opts, args = getopt.getopt(argv, 'i:v', [
+ opts, args = getopt.gnu_getopt(argv, 'i:v', [
'verbose', 'help'])
except getopt.GetoptError as e:
@@ -276,7 +276,7 @@ class InstanceMigrateCLI(pki.cli.CLI):
def execute(self, argv):
try:
- opts, args = getopt.getopt(argv, 'i:v', [
+ opts, args = getopt.gnu_getopt(argv, 'i:v', [
'tomcat=', 'verbose', 'debug', 'help'])
except getopt.GetoptError as e:
@@ -313,11 +313,12 @@ class InstanceMigrateCLI(pki.cli.CLI):
sys.exit(1)
if not tomcat_version:
- print('ERROR: missing Tomcat version')
- self.print_help()
- sys.exit(1)
+ tomcat_version = pki.server.Tomcat.get_major_version()
+
+ if self.verbose:
+ print('Migrating to Tomcat %s' % tomcat_version)
- module = self.top.find_module('migrate')
+ module = self.get_top_module().find_module('migrate')
module.set_verbose(self.verbose)
module.set_debug(self.debug)
@@ -347,7 +348,7 @@ class InstanceNuxwdogEnableCLI(pki.cli.CLI):
def execute(self, argv):
try:
- opts, args = getopt.getopt(argv, 'i:v', [
+ opts, args = getopt.gnu_getopt(argv, 'i:v', [
'verbose', 'help'])
except getopt.GetoptError as e:
@@ -373,7 +374,7 @@ class InstanceNuxwdogEnableCLI(pki.cli.CLI):
self.print_help()
sys.exit(1)
- # module = self.top.find_module('nuxwdog-enable')
+ module = self.get_top_module().find_module('nuxwdog-enable')
module = pki.server.cli.nuxwdog.NuxwdogEnableCLI()
module.set_verbose(self.verbose)
@@ -402,7 +403,7 @@ class InstanceNuxwdogDisableCLI(pki.cli.CLI):
def execute(self, argv):
try:
- opts, args = getopt.getopt(argv, 'i:v', [
+ opts, args = getopt.gnu_getopt(argv, 'i:v', [
'verbose', 'help'])
except getopt.GetoptError as e:
@@ -428,8 +429,7 @@ class InstanceNuxwdogDisableCLI(pki.cli.CLI):
self.print_help()
sys.exit(1)
- # module = self.top.find_module('nuxwdog-disable')
- module = pki.server.cli.nuxwdog.NuxwdogDisableCLI()
+ module = self.get_top_module().find_module('nuxwdog-disable')
module.set_verbose(self.verbose)
instance = pki.server.PKIInstance(instance_name)